Information Technology Reference
In-Depth Information
3.5 Language-Based Implementations
A number of language-based approaches have been proposed to implement aspect-
oriented programming. Many of these languages, such as AspectJ [60], Caesar [71],
Jiazzi [68], AspectC [20], and JAsCo [106] have been designed as extensions to ex-
isting languages. Other novel language-based concepts, such as composition filters
that manipulate the messages passing between objects, have also been proposed
[12].
These languages and systems have typically been produced by the research
community attempting to understand the practical value of AOP in terms of how
aspects are used, the types of designs and patterns that may emerge, and how
effective crosscutting modularity actually is [60].
The most popular language-
based system is currently AspectJ.
3.5.1
AspectJ
AspectJ is an extension to the Java programming language that was developed by
Kiczales et al. [59] at Xerox's Palo Alto Research Centre. The AspectJ language
is designed to be a simple and practical aspect-oriented extension to the Java
language that can be used to code crosscutting concerns that would otherwise
lead to tangled code [60].
AspectJ is designed as a compatible extension to Java where compatibility is
defined by Kiczales et al. [60]as:
Upward compatibility - all legal Java programs are legal AspectJ programs.
Platform compatibility - all legal AspectJ programs must run on standard
Java virtual machines.
Tool Compatibility - all existing tools, including IDEs, documentation tools,
and design tools should be able to be extended to support AspectJ.
Programmer compatibility - programming in AspectJ must feel like a natural
extension to programming in Java.
While early versions of AspectJ operated on source code, later versions alter
the bytecode generated by the Java compiler, thereby allowing aspects to be used
in situations where the source code is not available.
As discussed in Section 3.3 join points are well-defined points in the execution
flow of a program. AspectJ supports a number of join points as listed in Table 3.1
[60].
A pointcut in AspectJ is a set of join points that may be matched at runtime.
For example, the pointcut 2 :
call(void Point.setX(int)) ||
call(void Point.setY(int))
2 These examples are reproduced from Kiczales et al. [60, 61].
 
Search WWH ::




Custom Search