Aspect Oriented Programming (AOP)Aspect-Oriented Programming (AOP) is one of new buzz-words at the high-end of Java technology. AOP addresses Cross-Cutting concerns in a project. These are areas of functionality that are not limited to a single class but instead are applicable across a whole range of classes. The oft-quoted example is application logging, developers can spend considerable time on adding logging and diagnostic code to their class implementations. AOP allows features like logging, especially method-call tracing, to be abstracted out as an Aspect and applied across a whole set of classes. Higher-level application features such as authorization, access-control, and transactions can be viewed as cross-cutting concerns. I first ran into AOP via the AspectJ project over 3 years ago. AspectJ used a precompiler to add aspects, declared in a separate source file using regular expressions to match class names and methods to be enhanced. Since I work for clients for limited engagements I have never felt comfortable leaving a client with a project that depends upon a source-code pre-processor that the client's own staff may not have used. Recently, however, the industry seems to be embracing AOP in a more "wholesome" form. The JBOSS project has embraced Aspect Oriented programming for it's 4.0 release. The JBOSS implementation uses run-time byte-code modification to enhance classes. The byte-code enhancement can be made via API calls into the AOP framework classes or by dropping an XML descriptor file into your jar file. The enhancements are specified as:
Since the modifications are made at run-time, third-party classes can be modified. JBOSS is heading towards a J2EE++ world where the JBOSS container is J2EE compliant but AOP can be used instead of EJB to enforce deployment concerns such as transactions, security, and persistence. This will be a major leap for J2EE developers who can return to modeling pure Java Objects, with inheritance and add the J2EE features via AOP instead of the current method of subclassing and interfaces. Business logic can be tested outside the J2EE container and deployed into an Enterprise-Savvy environment with AOP. This seems very powerful, and if you ever programmed on NeXT or Mac OS X Cocoa you'll recognize features that match the Categories and poseAs: features of Objective-C. For more information on Aspect-Oriented Programming: |
Calendar
Categories
Archives
XML/RSS Feed
Powered by
|
||||||||||||||