AspectJ


AspectJ
AspectJ
Paradigm(s) aspect-oriented
Appeared in 2001 (2001)
Developer Eclipse Foundation
Stable release 1.6.11 (March 15, 2011; 7 months ago (2011-03-15))
Major implementations The AspectJ Development Tools for Eclipse
Implementation language Java
OS Cross-platform
License Eclipse Public License
Usual filename extensions aj
Website http://www.eclipse.org/aspectj/

AspectJ is an aspect-oriented extension created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely-used de-facto standard for AOP by emphasizing simplicity and usability for end users. It uses Java-like syntax and has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.

Contents

Simple language 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:

  • inter-type declarations—allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:
aspect VisitAspect {
  void Point.acceptVisitor(Visitor v) {
    v.visit(this);
  }
}
  • pointcuts — allow a programmer to specify join points (well-defined moments in the execution of a program, like method call, object instantiation, or variable access). All pointcuts are expressions (quantifications) that determine whether a given join point matches. For example, this point-cut matches the execution of any instance method in an object of type Point whose name begins with set:
pointcut set() : execution(* set*(..) ) && this(Point);
  • advice — allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. Here, the advice refreshes the display every time something on Point is set, using the pointcut declared above:
after () : set() {
  Display.update();
}

AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). See the AspectJ Programming Guide for a more detailed description of the language.

AspectJ compatibility and implementations

AspectJ has been designed to be implemented in many ways, including source- or bytecode-weaving and directly in the VM (virtual machine). In all cases, the AspectJ program is transformed into a valid Java program run in a Java VM. Any classes affected by aspects are binary-compatible with the unaffected classes (in order to maintain compatibility with any classes that were compiled with the unaffected originals). Supporting multiple implementations allows the language to grow as technology changes, and being Java-compatible ensures platform availability.

Key to its success has been engineering and language decisions designed to make the language usable and programs deployable. The original Xerox AspectJ implementation used source weaving, which required access to source code. When Xerox contributed the code to Eclipse, AspectJ was reimplemented using the Eclipse Java compiler and a bytecode weaver based on BCEL, so developers could write aspects for code in binary (.class) form. At this time the AspectJ language was restricted to support a per-class model essential for incremental compilation and load-time weaving. This made IDE integrations as responsive as their Java counterparts, and it enabled developers to deploy aspects without altering the build process. This led to increased adoption, as AspectJ became usable for impatient Java programmers and enterprise-level deployments. Since then, the Eclipse team has increased performance and correctness, upgraded the AspectJ language to support Java 5 language features like generics and annotations, and integrated annotation-style pure-java aspects from AspectWerkz.

The Eclipse project supports both command-line and Ant interfaces. A related Eclipse project has steadily improved the Eclipse IDE support (AJDT) for AspectJ and other providers of crosscutting structure. IDE support for emacs, NetBeans, and JBuilder foundered when Xerox put them into open source, but support for Oracle's JDeveloper did appear. IDE support has been key to Java programmers using AspectJ and understanding crosscutting concerns.

BEA has offered limited support in a VM for aspect-oriented extensions, but for extensions to be supported in all Java VM's would require agreement through Sun's Java Community Process (see also the java.lang.instrument package available since Java SE 5 which is some kind of common ground for JVM load-time instrumentation).

Academic interest in both the semantics and implementation of aspect-oriented languages has surrounded AspectJ since its release. The leading research implementation of AspectJ is the AspectBench Compiler, or abc; it supports extensions for changing the syntax and semantics of the language and forms the basis for many AOP experiments that the AspectJ team can no longer support, given its broad user base.

Many programmers discover AspectJ as an enabling technology for other projects they use, most notably Spring AOP. A sister Spring project, Spring Roo, automatically maintains AspectJ inter-type declarations as its principal code generation output.

History and contributors

Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term "crosscutting". Fourth on the team, Chris Maeda coined the term "aspect-oriented programming." Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).

Jonas Boner and Alex Vasseur engineered the AspectWerkz project, and later contributed to the AspectJ project when it merged in the AspectWerkz annotation style and load-time weaving support.

The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).

Bibliography

See also

External links


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • AspectJ — Saltar a navegación, búsqueda AspectJ es un lenguaje de programación orientado por aspectos construido como una extensión del lenguaje Java creado en Xerox PARC. Un compilador de AspectJ hace llegar la noción de aspecto hacia el código de máquina …   Wikipedia Español

  • AspectJ — ist eine aspekt orientierte Erweiterung von Java, welche bei Xerox PARC entwickelt wurde und nun ein Open Source Projekt der Eclipse Foundation ist. Es ist als alleinstehendes Programm und als Eclipse Zusatzmodul verfügbar.[1]Ein AspectJ Compiler …   Deutsch Wikipedia

  • AspectJ — es un lenguaje de programación orientado por aspectos construido como una extensión del lenguaje Java creado en Xerox PARC. Un compilador de AspectJ hace llegar la noción de aspecto hacia el código de máquina virtual implementando así una noción… …   Enciclopedia Universal

  • AspectJ — ██████████30  …   Wikipédia en Français

  • Aspekt-orientierte Programmierung — Die Artikel Aspektorientierte Programmierung und Cross Cutting Concern überschneiden sich thematisch. Hilf mit, die Artikel besser voneinander abzugrenzen oder zu vereinigen. Beteilige dich dazu an der Diskussion über diese Überschneidungen.… …   Deutsch Wikipedia

  • Aspektorientierung — Die Artikel Aspektorientierte Programmierung und Cross Cutting Concern überschneiden sich thematisch. Hilf mit, die Artikel besser voneinander abzugrenzen oder zu vereinigen. Beteilige dich dazu an der Diskussion über diese Überschneidungen.… …   Deutsch Wikipedia

  • Aspect-oriented programming — (AOP) is a programming paradigm that increases modularity by allowing the separation of cross cutting concerns.Separation of concerns entails breaking down a program into distinct parts (so called concerns , cohesive areas of functionality). All… …   Wikipedia

  • Aspektorientierte Programmierung — (AOP) ist ein Programmierparadigma für die Objektorientierte Programmierung, um generische Funktionalitäten über mehrere Klassen hinweg zu verwenden (Cross Cutting Concern). Logische Aspekte eines Anwendungsprogramms werden dabei von der… …   Deutsch Wikipedia

  • Aspect-oriented software development — (AOSD) is an emerging software development technology that seeks new modularizations of software systems. AOSD allows multiple concerns to be expressed separately and automatically unified into working systems.Traditional software development has …   Wikipedia

  • Аспектно-ориентированное программирование — Парадигмы программирования Агентно ориентированная Компонентно ориентированная Конкатенативная Декларативная (контрастирует с Императивной) Ограничениями Функциональная Потоком данных Таблично ориентированная (электронные таблицы) Реактивная …   Википедия


Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.