Introduction


This chapter shows how aspects in AspectJ can be used statically to introduce behavior and interfaces to existing classes using static cross-cutting techniques. Using these techniques, classes can be extended to implement interfaces, extend from new parent classes, introduce new methods and attributes, soften exceptions that are raised, and inherit from multiple base classes.

Static cross-cutting is powerful and must be used with care. Problems that were deliberately avoided by language constraints, such as multiple inheritance complications, are possible and must be considered before they are used. There are two schools of thought on this. Some people argue the developer should decide if they want to use the more complex techniques and, therefore, accept the potential problems. Others, such as the designers of Java, attempt to constrain these decisions as much as possible using the language.

Ultimately, the individual's opinions or the organization's style determines whether static cross-cutting techniques are acceptable. However, it is useful to know that these techniques exist within the aspect developers toolbox.



AspectJ Cookbook
Aspectj Cookbook
ISBN: 0596006543
EAN: 2147483647
Year: 2006
Pages: 203
Authors: Russ Miles

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