
Tool-supported Refactoring of Aspect-oriented Programs vorgelegt von Diplom-Informatiker Jan Wloka Von der Fakult¨atIV – Elektrotechnik und Informatik der Technischen Universit¨atBerlin zur Erlangung des akademischen Grades Doktor der Ingenieurwissenschaften (Dr.-Ing.) genehmigte Dissertation Promotionsausschuß Vorsitzender: Prof. Dr.-Ing. Hans-Ulrich Post Berichter: Prof. Dr. Stefan J¨ahnichen Berichter: Prof. Dr. Robert Hirschfeld Tag der wissenschaftlichen Aussprache: 23. Mai 2007 Berlin 2007 D 83 II Abstract Aspect-oriented programming offers a new modularization concept for improving the modularity of crosscutting concerns. This concept is mainly realized by an advanced mechanism for composing program behavior, called pointcut and advice. Software evolution of aspect-oriented systems, and particularly software refactoring, has been considered as problematic, because even local changes in the source code can result in unpredictable effects on the behavior of an aspect-oriented program. In a first part of this thesis, we classify general attributes of existing approaches for composing program behavior in AOP and illustrate how each attribute is responsible for the evolution-related problems in the context of refactoring. We conclude that pointcuts specify properties of program representations to capture a certain program behavior, and identify the missing connection between a specification of such a property and the targeted behavior as primary reason for the evolution problems. To overcome these problems, we integrate ideas drawn from the study of automated software refactoring, static change impact analysis, and qualitative program analysis into an impact analysis approach for verifying the validity of pointcuts in aspect-oriented programs. We propose a model for pointcuts that represents every specification of a property of a program representation explicitly by an individual element. Based on this pointcut model a change impact analysis for pointcuts can detect change effects on every specified property, assess how precise a matching element of a program representation is specified, and derive invalidated specifications. The change impact analysis is integrated into a refactoring approach that makes applied changes explicit and uses the impact assessment for an automated computation of pointcut updates. We also present a prototype refactoring tool, called Soothsayer, that implements our refactoring approach. The tool assists the developer in estimating effects on existing aspects, in detecting invalidated pointcuts, and in defining pointcut adjustments. An experimental evaluation of our approach using the tool has validated our expectations. III IV Acknowledgments I would like to expression my gratitude to the people who helped me to make this dissertation a reality. First and foremost, I wish to thank my adviser, Stefan J¨ahnichen, who gave me the opportunity to work in an inspiring environment with the freedom to experience many different aspects of software engineering. I also want to thank the second reviewer, Robert Hirschfeld, for his very detailed and good critique on my writing, and his encouraging words in the final stage of this thesis. Many thanks also to all the colleagues who have helped me during my work on this thesis. I am grateful to have had the opportunity to work with such outstanding people. In particular, I would like to thank Stephan Herrmann for inspiring me with his work on Object Teams and for kindly sharing with me his knowledge about many aspects of programming language design. I would also like to thank my students, Jochen H¨ansel, Jaroslav Svacina, and Sascha Kolewa, who contributed to this research with the work on their diploma theses and also often with lively discussions about this topic. I especially would like to thank my friends for their support in various aspects of my life during the work on this thesis. Special thanks go to Thomas Dudziak, Rodger Burmeister, and Christian Storl for the sometimes thought-provoking but always inspir- ing discussions, and in particular for the tough job of prove-reading this thesis. I am also very grateful to all people that supported and hosted me during my travels abroad. In particular, I thank Alessandro Garcia for making my visit in Lancaster pos- sible. The time I got to spend with you was truly unforgettable. Thanks also to Claudio Sant’Anna (best Brazilian guitar player on planet), Luca Sabatucci, Vander Alves and the rest of the Brazilian connection. Very special thanks go to my family. I thank my parents and my sister for their un- ending love and support, and for the wonderful environment I grew up in. I have had a magnificent time with you and I cannot express how happy it makes me to be part of our family. Most importantly, I thank Dana, my love, my best friend, and now also my wife. This work would not have been possible without her love, admirable patience, and encourage- ment through the long writing process. There is nothing that could make me happier. V VI Contents 1 Introduction 1 1.1 The Problem of Refactoring Aspect-oriented Programs . 2 1.1.1 Tool-supported Refactoring . 2 1.1.2 Aspect-oriented Programming . 3 1.1.3 Refactoring Aspect-oriented Programs . 4 1.2 Our Approach . 6 1.3 Contributions . 6 1.4 Thesis Outline . 7 2 Refactoring in the Presence of Aspects 11 2.1 Preservation of Structural Composition . 11 2.2 Core Terminology . 13 2.2.1 Concerns in Software Systems . 13 2.2.2 AOP Language Terms . 13 2.2.3 Joinpoints and Pointcuts . 14 2.2.4 Refactoring and Program Transformation . 16 2.2.5 Aspect-oriented Composition . 17 2.3 An Illustrating Example . 17 2.3.1 A Simple Insurance Application . 18 2.3.2 Refactoring Scenarios . 20 2.3.3 Summary . 23 2.4 Selection of Joinpoints . 24 2.4.1 Points of Reference . 25 2.4.2 Means of Identification . 27 2.4.3 Means of Specification . 33 2.5 Preservation of Behavioral Composition . 36 2.5.1 Change Effects on Pointcuts . 37 2.5.2 Challenges in Refactoring Aspect-oriented Programs . 39 2.6 Summary . 42 3 State of the Art 45 3.1 Aspect-oriented Refactoring . 45 3.1.1 Extension of existing Refactorings . 45 3.1.2 Tool-supported Extraction of Crosscutting Concerns . 46 3.1.3 Behavior Preservation in Aspect-oriented Refactoring . 48 3.2 Tool Support for Software Evolution . 51 3.2.1 Change Impact Analysis . 51 VII 3.2.2 Verification and Testing of Pointcuts . 54 3.2.3 Generation of Pointcuts . 55 3.3 Aspect-aware Declarations . 57 3.3.1 Meta-level Annotations . 57 3.3.2 Model-based Pointcuts . 58 3.3.3 Aspect-aware Interfaces . 60 3.4 Critical Analysis . 61 3.4.1 Expressing the Pointcut’s Intention . 62 3.4.2 Analyzability of Pointcuts . 63 3.4.3 Behavior Preservation in AOP . 63 3.4.4 Generation of Pointcuts . 65 3.5 Summary . 66 4 An Aspect-aware Refactoring Process 69 4.1 Extending Tool-supported Refactoring . 69 4.1.1 Standard Workflow for Tool-supported Refactoring . 69 4.1.2 Additional AOP-specific Computations . 70 4.1.3 A Workflow for Refactoring Aspect-oriented Programs . 72 4.2 Extending Refactorings with Change Information . 73 4.2.1 Composition of Refactorings . 73 4.2.2 A Model of Atomic Changes . 74 4.3 Summary . 75 5 A Change Impact Analysis for Pointcuts 77 5.1 Analysis Approach at a Glance . 77 5.1.1 Concrete Goals . 77 5.1.2 Analysis Process . 78 5.2 A Running Example . 82 5.2.1 Behavior of the Example Program . 82 5.2.2 Push Down Method Refactoring . 83 5.3 Static Approximation of Dynamic Properties . 83 5.3.1 Dynamic Program Representations . 84 5.3.2 Properties of Dynamic Program Representations . 85 5.3.3 Static Representation of Dynamic Properties . 88 5.3.4 Static Evaluation of Cflow Properties . 93 5.4 The Pointcut Model . 98 5.4.1 Notation Remarks . 99 5.4.2 Static Properties . 99 5.4.3 Dynamic Properties . 101 5.4.4 Logic Combinations . 102 5.4.5 Examples . 102 5.5 The Pointcut Selection Model . 104 5.5.1 A Pointcut’s Selection . 104 5.5.2 Computation of the Pointcut Selection Model . 105 5.5.3 Static Properties . 105 5.5.4 Dynamic Properties . 106 5.5.5 Example . 107 VIII 5.6 Change Impact Classification . 107 5.6.1 Specification Completeness . 108 5.6.2 Match Scope . 109 5.6.3 Execution Semantics . 110 5.6.4 Degree of Dependency . 110 5.6.5 Match Impact . 111 5.7 Summary . 112 6 Computation and Generation of Pointcut Updates 115 6.1 Update Determination Process . 115 6.1.1 Invalidated vs. affected pointcuts . 115 6.1.2 Process Overview . 116 6.2 Update Decision Making . 117 6.2.1 Update Decision Criteria . 117 6.2.2 Update Decision Procedure . 118 6.3 Generation of Pointcuts . 119 6.3.1 Pointcut Update Patterns . 119 6.3.2 Update Computation Algorithm . 120 6.3.3 Algorithm Issues . 121 6.4 Summary . 122 7 Soothsayer: An Aspect-aware Refactoring Tool 125 7.1 Architectural Overview . 125 7.2 Extended Refactoring Workflow . 128 7.3 Implementation of the Refactoring and Analysis Steps . 131 7.3.1 Aspect-aware Refactoring . 131 7.3.2 Abstract Syntax Graph Creation . 132 7.3.3 Pointcut Model Creation . 133 7.3.4 Pointcut Resolving . 133 7.3.5 Atomic Change Model Creation . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages197 Page
-
File Size-