Section 7.5. RELATED WORK


7.5. RELATED WORK

The notion of shyness is linked to the notion of quantification [7]. AOP is quantification because an aspect works with an entire family of base programs [24]. DJ [29, 31] is closely related to DemeterJ [32], a preprocessing tool that takes a class dictionary file (containing a textual representation of a UML class diagram, with syntax directives for parsing and printing object structures) and some behavior files (containing regular Java methods to be attached to the classes in the class dictionary, plus traversal method specifications, visitor methods, and adaptive methods that connect a traversal with a visitor class) and generates plain Java code for those classes with traversal methods attached along with a parser and some custom visitors such as for printing, copying, or comparing object structures. Demeter/C++ [15, 23] is a predecessor of DemeterJ with similar capabilities. DJ shares the same traversal strategy language and traversal graph algorithms as DemeterJ but does no code generation and is a pure-Java library.

Besides being easier to use with existing Java code, DJ has a few other advantages over DemeterJ. One is the ability to traverse classes for which the programmer does not have source code or when he or she is not able or willing to modify the source code. For example, one might traverse parts of Java's Swing library of GUI widgets. DJ can traverse public accessor methods or may even use private methods and fields if the JVM's security manager allows reflective access to private parts. Another new feature of DJ is the ability to work with subgraphs of a class graph; in DemeterJ, all traversals are computed in the context of the whole class graph defined in the class dictionary, but in DJ, you can create new class graphs by selecting a subgraph with a traversal strategy. In addition, DJ, allows components to be more generic by taking class graphs, traversal strategies, or classes to be visited as run-time parameters. These latter two advantages are due to the reification of concepts that only exist at compile-time in DemeterJ as first class objects in DJ.

An adaptive object-model [39] is an object model that is interpreted at runtime. If an object model is changed, the system changes its behavior. Java's object model can't be changed at runtime (other than dynamic class loading), but DJ interprets the object model when doing traversals.

DJ's Visitor class is similar to reflective visitor-beans [25] and Walkabout classes [35]. However, neither of those provides a language for customizing traversals. Java Object Query Language (OQL), a binding of OQL from ODMG 2.0 [4] to Java, treats query specifications much like DJ treats traversal strategy specifications [9]. An OQLQuery object can be constructed from a string describing a query; the query can then be executed by calling the execute() method on the OQLQuery object. Queries are either compiled dynamically at runtime or interpreted. An example of a query is:

 OQLQuery query = new OQLQuery     ("select p.getSpouse from p in persons"); Set spouses = (Set) query.execute(); 



Aspect-Oriented Software Development
Aspect-Oriented Software Development with Use Cases
ISBN: 0321268881
EAN: 2147483647
Year: 2003
Pages: 307

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net