Analysis Aspects • Deters and Cytron propose to use analysis aspects to get profiling information from running Java programs. • We explore the design issues behind analysis aspects and show, by example, how to write an interesting aspect-oriented framework that measures bad coupling between objects/aspects.
Decoupling of Aspects • Four aspects: Supplier, Target. Bin. Stack, Checker and Statistics are an aspectoriented framework. • Customization is done by defining subaspects of Supplier and Target. Bin. Stack. • Decoupling of aspects is achieved through – abstract pointcuts and – Named, concrete pointcuts that are “exported”.
Instrumentation of Java programs with Aspects Aspect framework Aspect Diagram Supplier Target. Bin. Stack Immediate. Part. Bin Argument. Bin Checker Locally. Constructed. Bin Requirements: uses pointcuts Return. Value. Bin Global. Preferred. Bin Statistics Good Separation of Concerns in Law of Demeter Checker http: //www. ccs. neu. edu/home/lieber/com 3205/f 02/solutions/com 3205/hw 04/ (part 3)
Explanation • The *bin* aspects collect potential preferred supplier objects that represent good coupling in the context of a method body. • The Checker aspect checks each method call whether the receiver is a preferred supplier object. • The Statistics aspect counts events generated by the Checker aspect.