Aspect Oriented Programming improves quality of objectoriented systems. Especially the separation between the technology and realization of the business requirements can be better separated. Cross cutting functionality (transactions, synchronization, locking, audits, field and cross-validation, security, change notification as well as business functionality) can be factored out from the objects using aspects, which simplifies the objects and makes them more reusable. Some of the decorating aspects could be also easily solved with closures, but there is still room for AOP in Java.
The problem with AOP: the realization is higly dependent on the Java version. For instance JDK 1.4 requires the usage of a custom classloader (or preprocessor for compile time weaving), Java SE 5 is more flexible with agents. The next problem is the syntax - it is not standardized.
In Java SE you can use dynamic proxies, in Java EE 5 interceptors, or third-party frameworks like AspectJ.
I just wondering, why there is no JSR for AOP?
airhacks.fm the podcast:
Stay in touch: airhacks.news.