Refactoring and Code Generation Tools for AspectJ
Code generation and refactoring tools have been quite useful for developing object- oriented applications . They increase development productivity by automating tedious, repetitive, and error-prone tasks. By reducing the number of programming errors, they also help to improve software quality. Based on our experience developing AspectJ applications, we believe that aspect-aware code generation and refactoring tools can bring similar bene ts for the development of aspect-oriented applications as well. Although aspect-oriented languages such as AspectJ provide some of the power of metaprogramming con- structs, we think this is not enough for dispensing with code manipulation tools. In fact, code generation tools could generate part of the implementation of spe- ci c AspectJ patterns. For instance, we have noticed [6, 7] that the implementation of persistence and distribution aspects in several applications might follow the same structure, which could be automatically generated. The generation tools could also be used to instantiate speci c AspectJ frameworks. This sometimes involves te- dious coding that can only be avoided by generation tools or metaprogramming constructs more powerful than the ones currently supported by AspectJ. Similarly, AspectJ-aware refactoring tools could be used for improving and main- taining existing AspectJ code. Again, this would be necessary when implementing distribution concerns as suggested elsewhere , since for every newly introduced remote method we should introduce an associated advice following an speci c pat- tern. The advice should also be removed when the method is removed. User de ned refactorings could simultaneously change both the pure Java and the AspectJ code, keeping the code consistent. AspectJ refactoring tools could also help developers to restructure Java code in order to separately implement di erent concerns using AspectJ features. This is necessary, for example, when migrating Java applications to AspectJ. A well de ned set of refactorings can guide the developer in this task and guarantee that the resulting AspectJ system preserves the behavior of the original system. Sometimes refactorings are also useful for exposing join points that should be intercepted by the aspect code.
Free download research paper