Third-Party Composition of AOP Mechanisms
Total Page:16
File Type:pdf, Size:1020Kb
Third-Party Composition of AOP Mechanisms Sergei Kojarski M.Sc., Northeastern University, 2004 B.Sc., Perm State Technical University, 2001 A thesis submitted to the Faculty of the Graduate School of Northeastern University in partial fulfillment of the requirements for the degree of Doctor of Philosophy College of Computer and Information Science 2008 Kojarski, Sergei (Ph.D., Computer Science) Third-Party Composition of AOP Mechanisms Thesis directed by Prof. David H. Lorenz Abstract Domain-specific aspect-oriented language extensions offer unique capabilities to deal with a variety of crosscutting concerns. In principle, one should be able to use several of these exten- sions together in a single program. In practice, however, each extension implements its own specialized weaver and the different weavers are incompatible. Even if the weavers were com- patible, combining them is a difficult problem in general, because each extension defines a new language with its own semantics. In this dissertation work, we introduce, analyze and present a solution to the aspect extension composition problem. We present a scalable, general, and practical framework, named AWESOME, for composing aspect weavers. To be scalable, the AWESOME framework supports third-party composition of aspect weavers. To be general, the framework provides means for customizing the composition behavior. Furthermore, to be prac- tically useful, there is no framework-associated degradation in the performance of compiled aspect programs. In memory of John Vlissides — — I was greatly privileged to have had him on my Committee v Acknowledgements I thank my mother for supporting me in my education pursuits. Despite difficult times that our family faced in 1990s my mother managed to give me the best education our home city has to offer. She then stimulated me to apply for PhD studies in United States, and fully supported me in my preparation for graduate exams. During my PhD studies she has been continuously encouraging me in my education and research efforts. I thank my advisor Professor David H. Lorenz for his outstanding contribution to my pro- fessional establishment. David invested enormous amount of time and effort into development of my research skills. I spent most of my studentship standing next to a whiteboard in David’s office, working with him on technical papers, and discussing research ideas. It is this collabo- ration that taught me a discipline of thought, methods of analysis, and presentation techniques that are fundamental for a researcher. David not only developed my skills but also did an exceptional job to ensure that I’m fully supported throughout the duration of my studies. This effort goes far beyond regular administrative activities of a PhD advisor. I’m extremely thankful to David for this support. It gave me peace of mind and time necessary to go deep into the research work. I also thank the other members of my thesis committee, Professors Gene Cooperman, Eric Ernst, David Kaeli, Karl Lieberherr and Dr. John Vlissides, for their valuable comments. I am particularly grateful to Professor Cooperman whose goal was always to support my own goals throughout the completion of this dissertation. The generous support of the National Science Foundation is acknowledged. vi Contents Contents vi List of Tables xii List of Figures xiii List of Listings xv List of Terms xviii List of Symbols xxiii 1 Introduction 1 1.1 Thesis....................................... 2 1.2 TheAspectExtensionCompositionProblem. ....... 3 1.2.1 Thecomponentabstractionproblem . ... 4 1.2.2 Thecompositionspecificationproblem . .... 4 1.2.3 Thecompositionimplementationproblem . ..... 5 1.3 MainResults ................................... 6 1.3.1 PluggableAOP.............................. 6 1.3.2 Thecomponentabstractionproblem . ... 7 1.3.3 Thecompositionspecificationproblem . .... 7 1.3.4 Thecompositionimplementationproblem . ..... 8 vii 1.4 StructureoftheDissertation . ..... 8 2 State of the Art 10 2.1 Aspect-OrientendLanguages . .... 10 2.1.1 AspectJ.................................. 10 2.1.2 AspectWerkz ............................... 14 2.1.3 COOL ................................... 15 2.1.4 Hyper/J.................................. 18 2.2 ModelingAOP .................................. 22 2.3 CompositionofAspects. .. 25 2.4 CompositionofAspectExtensions . ..... 26 2.4.1 Reflex................................... 26 2.4.2 XAspects ................................. 29 2.4.3 AspectJ/5................................. 30 3 Motivation 33 3.1 SignificanceoftheCompositionProblem . ...... 33 3.1.1 AspectDSLs ............................... 35 3.1.2 Reuse................................... 35 3.2 LackofSupportforComposingAspectExtensions . ........ 36 3.2.1 AspectJ/5................................. 37 3.2.2 Reflex................................... 39 3.2.3 XAspects ................................. 41 3.3 ComplexityoftheCompositionProblem . ...... 43 3.3.1 NoCorrectTranslation . 44 3.3.2 NoCorrectSequentialInstrumentation . ..... 45 3.4 Summary ..................................... 46 viii 4 The Component Abstraction Problem 47 4.1 EvolutionofAOPModels ... ... .. ... ... ... .. ... ... ... 49 4.2 Analysis...................................... 51 4.2.1 TheWeavingProblem . ... .. ... ... ... .. ... ... ... 52 4.2.2 TheWeavingPlan ............................ 52 4.2.3 TheWeavingProcess.. ... .. ... ... ... .. ... ... ... 53 4.2.4 Notation ................................. 55 4.3 DesignofaNonreactiveWeavingProcess . ...... 56 4.4 DesignofaReactiveWeavingProcess . ..... 58 4.5 TheDualityofOpenClasses . .. 62 4.5.1 ANonreactiveOCWeavingProcess . 62 4.5.2 AReactiveOCWeavingProcess. 62 4.6 ComposingAspectMechanisms . .. 65 4.6.1 Nonreactiveextensions. 65 4.6.2 Reactiveextensions. 65 4.7 BeyondConceptualModels. .. 67 4.7.1 AbstractDomains............................. 67 4.7.2 TheWeavingProcessasaUnifyingConcept . ... 68 4.7.3 CyclicDependencyinAspectJ . 68 4.7.4 AdvisingAdviceExecution . 68 4.7.5 UntanglingtheBaseandtheAspectMechanisms . ..... 69 4.8 Top-DownClassification . .. 69 4.8.1 SymmetricversusAsymmetricLanguages. .... 69 4.8.2 StaticversusDynamicLanguages . .. 70 4.8.3 StaticversusDynamicSemantics . .. 71 4.9 Top-DownConstruction . 71 4.9.1 Component-BasedDesign . 71 ix 4.9.2 NewAOPFunctionality . 72 4.10Summary ..................................... 73 5 The Composition Specification Problem 75 5.1 Scope ....................................... 76 5.2 Features...................................... 77 5.2.1 JoinPointFeatures ............................ 78 5.2.2 AdviceFeatures ............................. 79 5.3 PatternsofInteraction. .... 81 5.3.1 InfluencingversusInducing . 82 5.3.2 GenuineversusIncidental . 82 5.3.3 ForeignAdvisingversusCo-advising . .... 83 5.4 Co-advisingPatterns ... ... ... .. ... ... ... .. ... ... .. 84 5.5 ForeignAdvisingPatterns . ... 87 5.6 BuildyingaCompositionSpecification . ....... 92 5.6.1 The COOLAJSpecification........................ 93 5.6.2 TheAJWSpecification. 96 5.6.3 The COOLAJWSpecification ...................... 99 5.6.4 ScalabilityandCompleteness . 102 5.7 AnalyzingExistingCompositions . ..... 102 5.8 Summary ..................................... 104 6 The Composition Implementation Problem 106 6.1 SystemDesignRequirements. 108 6.1.1 Granularity ................................ 108 6.1.2 Decoupling................................. 109 6.1.3 Composability .............................. 109 6.1.4 Customizability.............................. 112 x 6.2 AnAspectCompiler ............................... 112 6.3 ACompilerfor COOL ............................... 119 6.3.1 Front-endTranslation. 119 6.3.2 Back-endWeaving ... ... .. ... ... ... .. ... ... ... 122 6.4 AnAspect-OrientedArchitecture. ...... 124 6.4.1 Decoupling ................................ 124 6.4.2 Composability .............................. 127 6.4.3 Customizability.............................. 130 6.5 ImplementationbyRefactoringAspectJ . ....... 133 6.5.1 ImplementingaPlatform. 134 6.5.2 AnAbstractAspectMechanism . 136 6.5.3 ImplementinganAspectJMechanism . 137 6.5.4 ImplementinganAspectWerkzMechanism . 138 6.5.5 Implementing a COOL Mechanism.................... 140 6.6 Summary ..................................... 142 7 Evaluation 143 7.1 Case Study: Composing AspectJ, AspectWerkz, and COOL ........... 145 7.1.1 Implementing COOLAJ.......................... 145 7.1.2 ImplementingAJW .. ... .. ... ... ... .. ... ... ... 148 7.1.3 Implementing COOLAJW ........................ 149 7.2 Third-partyComposition . 149 7.3 Testing....................................... 152 7.3.1 TestingAspectJ.............................. 155 7.3.2 TestingAspectWerkz. 156 7.3.3 Testing COOL ............................... 157 7.3.4 TestingAJW ............................... 158 xi 7.3.5 Testing COOLAJ ............................. 160 7.3.6 Testing COOLAJW............................ 161 7.4 Performance.................................... 163 7.5 Summary ..................................... 165 8 Conclusion 167 8.1 SummaryofContribution. 171 8.2 BenefitsofApproach ............................... 173 8.3 LimitationsofApproach . 173 8.4 FutureDirections ................................ 175 Bibliography 177 A Publications 183 A.1 Pluggable AOP: Designing aspect mechanisms for third-partycomposition. I A.2 Modelingaspect mechanisms: A top-down approach. ......... II A.3 Identifying feature interactions in aspect-oriented frameworks. III A.4 AWESOME: An aspect co-weaving system for composing multiple aspect-oriented extensions.