ebook img

Migrating Object Oriented code to Aspect Oriented Programming PDF

182 Pages·2012·1.07 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Migrating Object Oriented code to Aspect Oriented Programming

PhD Dissertation International Doctorate School in Information and Communication Technologies DIT - University of Trento Migrating Object Oriented code to Aspect Oriented Programming Mariano Ceccato Advisor: Prof. Paolo Tonella Universita(cid:18) degli Studi di Trento December 2006 Abstract Aspect Oriented Programming (AOP) is a new programming paradigm that o(cid:11)ers a novel modularization unit for the crosscutting concerns. Func- tionalities originally spread across several modules and tangled with each other can be factored out into a single, separate unit, called an aspect. Al- though AOP was originally proposed for the development of new software, systems written using traditional modularization techniques may also ben- e(cid:12)t from the adoption of the more versatile decomposition o(cid:11)ered by AOP, in terms of code understandability and evolvability. The goal of this thesis is to investigate automated techniques that can be used to support the migration of existing Object Oriented Programming (OOP) code to AOP. To migrate an application to the new paradigm, a preliminary identi(cid:12)cation of the crosscutting concerns is required (aspect mining). Then refactoring is applied to transform the scattered concerns into aspects. The proposed methods have been assessed on case studies for a total of more than half a million lines of code. One of the proposed aspect mining method has also been compared with other state of the art methods. They all have been applied to a common case study and the results have been used to propose a brand new aspect mining technique, based on their combination. Keywords [Aspect Oriented Programming, Aspect Mining, Refactoring, Empirical Study] Contents 1 Introduction 1 1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 Contribution of the thesis . . . . . . . . . . . . . . . . . . 5 1.5 Structure of the Thesis . . . . . . . . . . . . . . . . . . . . 7 2 State of the Art 9 2.1 AOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2.1 Aspect Oriented Development . . . . . . . . . . . . 11 2.2.2 An AspectJ primer . . . . . . . . . . . . . . . . . . 18 2.3 Aspect Mining . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.4 Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3 Aspect Mining 29 3.1 Dynamic aspect mining . . . . . . . . . . . . . . . . . . . 29 3.1.1 Dynamic feature location . . . . . . . . . . . . . . . 29 3.1.2 Dynamic aspect mining technique . . . . . . . . . . 34 3.1.3 Clarifying example . . . . . . . . . . . . . . . . . . 37 3.1.4 Tool support . . . . . . . . . . . . . . . . . . . . . 39 3.1.5 Contribution to the state of the art . . . . . . . . . 40 i 3.2 Aspectizable interfaces . . . . . . . . . . . . . . . . . . . . 41 3.2.1 Aspectizable interfaces de(cid:12)nition . . . . . . . . . . 41 3.2.2 Aspectizable interfaces identi(cid:12)cation . . . . . . . . 45 3.2.3 Tool implementation . . . . . . . . . . . . . . . . . 47 3.2.4 Contribution to the state of the art . . . . . . . . . 48 4 Refactoring 51 4.1 Aspectizable interfaces . . . . . . . . . . . . . . . . . . . . 51 4.1.1 Refactoring process description . . . . . . . . . . . 51 4.1.2 Tool support . . . . . . . . . . . . . . . . . . . . . 56 4.2 Pointcut extraction . . . . . . . . . . . . . . . . . . . . . . 58 4.2.1 Extract Beginning/End of Method/Handler . . . . 61 4.2.2 Extract Before/After Call . . . . . . . . . . . . . . 63 4.2.3 Extract Conditional . . . . . . . . . . . . . . . . . . 65 4.2.4 Pre Return . . . . . . . . . . . . . . . . . . . . . . 66 4.2.5 Extract Wrapper . . . . . . . . . . . . . . . . . . . 67 4.2.6 Extract Exception Handling . . . . . . . . . . . . . 69 4.2.7 Pointcut Abstraction . . . . . . . . . . . . . . . . . 70 4.2.8 Iterative Refactoring Process . . . . . . . . . . . . . 71 4.2.9 Tool Implementation . . . . . . . . . . . . . . . . . 74 4.3 Contribution to state of the art . . . . . . . . . . . . . . . 76 5 Assessment 79 5.1 Assessment Subjects . . . . . . . . . . . . . . . . . . . . . 80 5.2 Dynamic Aspect Mining . . . . . . . . . . . . . . . . . . . 84 5.3 Aspect mining comparison . . . . . . . . . . . . . . . . . . 88 5.3.1 The fan-in analysis experiment . . . . . . . . . . . 88 5.3.2 The identi(cid:12)er analysis experiment . . . . . . . . . . 90 5.3.3 Selected concerns . . . . . . . . . . . . . . . . . . . 93 5.3.4 Limitations . . . . . . . . . . . . . . . . . . . . . . 97 ii 5.3.5 Complementarity . . . . . . . . . . . . . . . . . . . 98 5.3.6 De(cid:12)nition of the combined techniques . . . . . . . . 100 5.3.7 Analysis indicators . . . . . . . . . . . . . . . . . . 101 5.3.8 Experimental results . . . . . . . . . . . . . . . . . 102 5.4 Pointcut extraction . . . . . . . . . . . . . . . . . . . . . . 104 5.4.1 Refactoring . . . . . . . . . . . . . . . . . . . . . . 104 5.4.2 Pointcut Abstraction . . . . . . . . . . . . . . . . . 107 5.4.3 Separation of Concerns . . . . . . . . . . . . . . . . 108 5.4.4 Performances . . . . . . . . . . . . . . . . . . . . . 112 5.4.5 Size . . . . . . . . . . . . . . . . . . . . . . . . . . 112 5.4.6 Lessons Learned . . . . . . . . . . . . . . . . . . . . 113 5.5 Aspectizable interfaces . . . . . . . . . . . . . . . . . . . . 115 5.5.1 Aspectizable interfaces identi(cid:12)cation . . . . . . . . 115 5.5.2 Refactoring the aspectizable interfaces . . . . . . . 119 5.5.3 The empirical study . . . . . . . . . . . . . . . . . 122 5.5.4 Experimental hypotheses . . . . . . . . . . . . . . . 123 5.5.5 Internal quality attributes . . . . . . . . . . . . . . 124 5.5.6 External quality attributes . . . . . . . . . . . . . . 127 5.5.7 Internal quality attribute values . . . . . . . . . . . 130 5.5.8 External quality attribute values . . . . . . . . . . 136 5.5.9 Discussion . . . . . . . . . . . . . . . . . . . . . . . 141 6 Conclusions and Future Works 143 6.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . 143 6.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Bibliography 151 A Abstract Refactoring Descriptions 161 iii List of Tables 3.1 Programming languages and their supported programming paradigms. . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2 Execution traces for a use case with logging enabled (resp. disabled). . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.1 Java programs, case studies of the present assessment. . . . 81 5.2 JHotDraw Results (use-case speci(cid:12)c concepts). . . . . . . . 84 5.3 JHotDraw Results (generic concepts). . . . . . . . . . . . . 86 5.4 Assessment for the Undo seed. . . . . . . . . . . . . . . . . 87 5.5 Summary of the results of the fan-in analysis experiment. . 89 5.6 Selection of results of the identi(cid:12)er analysis experiment. . . 91 5.7 A selection of detected concerns in JHotDraw. . . . . . . . 93 5.8 Concerns identi(cid:12)ed by either dynamic or fan-in analysis. . 99 5.9 Recalled methods and precision before and after combination.102 5.10 Enabling OO transformations applied to the four case studies.105 5.11 Aspect refactorings applied to the four case studies. . . . . 106 5.12 Entities (types) and relationships (dependences) in the base code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 5.13 Base code size (LoC) before and after refactoring, for the classes subjected to refactoring. . . . . . . . . . . . . . . . 113 5.14 Data set under analysis. . . . . . . . . . . . . . . . . . . . 116 5.15 Precision and recall of the four aspect mining methods. . . 118 v 5.16 Features of the source code under analysis. The last three columns show the unique implemented interfaces, among them the aspectizable interfaces, and the number of imple- mentations of the aspectizable interfaces. . . . . . . . . . . 120 5.17 Aspectizable interfaces found in the source code under anal- ysis. The number of implementations is given in the last column. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 5.18 Experimentaldesign of the empiricalstudy tomeasure main- tenance and understanding times. . . . . . . . . . . . . . . 129 5.19 Internal quality metrics, divided into quartiles and com- puted either on the original or on the refactored code. . . . 131 5.20 Chi-square thresholds and values. For statistical signi(cid:12)- cance, Chi-square > Threshold is required. . . . . . . . . . 133 5.21 Understanding time (UTIME) and total maintenance time (MTIME) in seconds, measured in each experimental ses- sion. Average (Avg) and variance (Var) are also shown. . . 138 5.22 Two-factor Anova for MTIME and UTIME. SS = Sum of Squares, df = degrees of freedom, MS = Mean sum of Squares. For statistical signi(cid:12)cance, F > F-crit is required. . . . . . 139 vi

Description:
efit from the adoption of the more versatile decomposition offered by AOP, [Aspect Oriented Programming, Aspect Mining, Refactoring, Empirical.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.