Language Versus Framework

The designers of AspectJ elected to enhance the Java language to support AOP. Over the years, the AspectJ variant of Java has matured into a stable and complete AOP platform, with the AJDT offering excellent tool support.

However, changing the core Java language has met with a degree of criticism from some quarters. Some of the issues include the following:

  • Learning Java becomes more difficult because the additional keywords mean developers new to Java must embrace the concepts and semantics of both the OOP and AOP paradigms.

  • Compilation of Java and AOP hybrid languages requires the adoption of a new compiler.

  • Moving to an AOP language is an issue when looking to employ AOP on an existing project, since migration of the complete code base to the new language is required.

Recent AOP implementations take the approach of defining aspects externally to the Java application using a framework in order to circumvent these issues. Frameworks enable the superimposing of AOP concepts onto existing Java applications without the need to move the entire application to a new AOP compiler. These frameworks typically use XML configuration files or J2SE 5.0-style metadata annotations to specify pointcuts and advice within the main application, ensuring AOP-specific keywords are isolated from the application. Advice is defined as standard Java classes, referenced by the framework's configuration.

A main advantage of these frameworks is that they bring AOP to vanilla Java, thereby easing the task of adopting AOP techniques within existing systems.

AOP Framework Implementations

The number of open source AOP frameworks available is growing steadily as AOP continues to gain interest among the Java community. Table 11-1 lists a selection of the AOP frameworks available as open source.

Table 11-1. AOP Frameworks





A popular, easy-to-learn AOP framework for Java. Features include both bytecode and load-time weaving.


The JBoss AOP framework forms part of the JBoss application server and offers load-time and runtime aspect weaving. The framework is available standalone.


Nanning Aspects is a simple and scalable AOP framework for Java.


Offers new AOP language that is compatible with Java. The CAESAR language compiles to standard Java bytecode.


Java Aspect Components (JAC) is an open source project targeting the use of AOP for developing an aspect-oriented middleware layer.


Spring is an extensive Java-based framework in its own right based on the popular inversion of control (IOC) pattern. Spring also offers an AOP framework or is configurable to work with external AOP implementations.

To contrast AspectJ against a framework AOP implementation, we look at the approach to defining aspects taken by AspectWerkz.

    Rapid J2EE Development. An Adaptive Foundation for Enterprise Applications
    Rapid J2EEв„ў Development: An Adaptive Foundation for Enterprise Applications
    ISBN: 0131472208
    EAN: 2147483647
    Year: 2005
    Pages: 159
    Authors: Alan Monnox © 2008-2017.
    If you may any questions please contact us: