AspectJ |
AspectJ is an Aspect-oriented programming extension to the Java programming language created at Xerox PARC by Chris Maeda, who originally coined the term aspect-oriented programming (no one remembers exactly when). Gregor Kiczales coined the term crosscutting . The Xerox group s work was integrated into the Eclipse Foundation s Eclipse (computing) Java IDE in December 2002. This helped AspectJ become one of the most widely-used aspect-oriented programming languages.
In March 2005, AspectWerkz merged with AspectJ to form a single language. Other commercial Aspect-oriented frameworks include JBoss and Spring AOP.
= Simple Languge Description =
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects . Aspects can contain several entities unavailable to standard classes. These are:
::aspect VisitAspect { :::Point.acceptVisitor(Visitor v) { ::::v.visit(this); :::} ::}
::pointcut set() : execution(* *.set*(..) ) && this(Point);
::after () : set() { :::Display.update(); ::}
See the [http://www.eclipse.org/aspectj/doc/released/progguide/index.html AspectJ Programming Guide] for a more detailed description of the language.
= Tools, Compilation, and AspectJ =
The compilation of an AspectJ program includes an additional stage compared to non-aspect-oriented languages. This stage is called weaving . Weaving occurs after the normal compilation of the non-aspect, or base code , completes. The weaving process takes the aspects (pointcuts and advice) and determines where the advice may apply and alters the bytecode appropriately. Weaving may occur immediately after compilation, or this process may be delayed until the classes are loaded into the JVM. This process is known as load-time weaving.
The most widely used and most efficient compiler for AspectJ is maintained with the AspectJ project, but there is another, more extensible and research oriented, compiler called the Aspect Bench Compiler, or [http://aspectbench.org abc].
A suite of tools designed specifically to work with AspectJ in the Eclipse (computing) Java IDE has been developed as another project in the Eclipse Foundation. It is called AJDT. These tools help programmers understand how the aspects crosscut the base code.
= See Also =
= External links =
|
|