Section 7.6. CONCLUSION


7.6. CONCLUSION

AOP and AP have the same benefit list, namely understandability, maintainability, and reusability. The key idea behind AOP is "better modularization of concerns;" the key idea behind AP is "concern-shyness." Before the introduction of AOP, AP tried to fill both roles.

Traversal specifications can be applied to graphs other than the object graph. In particular, traversals can be applied to the dynamic call graph in AspectJ. In fact, AspectJ already uses structure-shy regular expressions to specify traversals. In AspectJ, we can write a traversal strategy: "from jp to *" in the form cflow(jp), and this qualifies as an application of structure-shy programming.

Generally, AP can benefit from AOP in that AP capabilities can be more easily implemented with an AOP language than with an object-oriented language. AOP can also benefit from AP in that those AP abilities can help in decoupling aspects from graph structures. For example, type patterns are complex pointcut descriptors that can be made structure-shy by using a traversal specification. Similarly, aspectual polymorphism [5] and parameterizing introductions with traversal specifications can help express complex introductions in AspectJ via a single structure-shy expression. Hence, the premise is that AP is a variety of AOP and AOP is a variety of AP.

In this chapter, we discussed how AOP and AP could be coupled. "Shyness" is an important concept not only for AP but also for AOP. When a module M1 keeps only limited information about another module M2, we say that M1 is M2-shy. If aspects are not "shy," their usefulness greatly decreases. There are three facets to shyness: (a) sharing only limited information, (b) communicating only to a few other modules, and (c) avoiding scattered communications. We have presented DJ, a pure-Java library supporting dynamic adaptive programming. DJ makes it easier to follow the Law of Demeter, loosening the coupling between the structure and behavior concerns and adapting to changes in the object model. It is more flexible and dynamic than the preprocessing approach taken by DemeterJ, using interpreting traversal strategies at runtime and reflection to traverse object structures with adaptive visitors. Expression of pointcuts at a higher level of abstraction is an important issue in AOP. Traversal-strategy-based pointcuts show one interesting way that this can be accomplished; contract-based pointcuts is another way [26]. AOP, specifically AspectJ, has developed a good model for expressing sets of join points in a call graph in a structure-shy way. Indeed, AspectJ is excellent for writing an object-form Law of Demeter checker that is so structure-shy that it works with any legal Java program [20, 30].



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