====== Pointcut generation for aspect-oriented refactoring ====== **Advisor(s):** [[SSELMember>mathieubraem |Mathieu Braem]], Kris Gybels, Andy Kellens and [[SSELMember>wimvanderperren |Wim Vanderperren]]. **Promotor:** [[SSELMember>VivianeJonckers|Viviane Jonckers]] Part of [[overview|Thesis and/or Apprenticeship Proposals 2006-2007]] ===== Context ===== Aspect-Oriented Software Development (AOSD) [1, 9] is a recent software programming paradigm that aims at providing a better separation of concerns. At its root is the observation that some concerns cannot be cleanly modularized using traditional abstraction mechanisms such as classes/ components. These so-called crosscutting concerns will therefore inevitably appear scattered across different modules of the system, making them difficult to comprehend and maintain. Typical examples of such concerns are tracing, synchronization and transaction management. Now that AOSD has matured to the level at which it is not only interesting to apply it to new software development pro jects, but also to bring its benefits to existing software systems. Aspect-oriented programming techniques can not just be used to prevent a concern from becoming tangled and scattered in a new software system, but also to clean up such already tangled and scattered concerns in existing systems. This of course leads to the question of how to find concerns in existing systems that can be more cleanly implemented using AOSD techniques, and how to transform the tangled and scattered implementation to an aspect. These questions are being addressed by two fields of research within AOSD: aspect mining and aspect-oriented refactoring. Aspect mining strives to identify crosscutting concerns in existing software systems. Two categories of partially automated aspect mining approaches exist. Browsing approaches aid a developer with exploring crosscutting concerns. Given a starting point in the code, also called a “seed”, they point out related parts of the code for further browsing. Developers can use this to reconstruct which parts of the code implement a certain concern. Automated approaches analyze the system and will propose a list of parts of the code that seem to be aspect candidates. This resulting list will have to be manually inspected by the developer, and might even be used as possible seeds for the browsing approaches. Aspect-oriented refactoring research aims to extend the catalog of ob ject-oriented refactorings [4] with refactoring patterns specific for AOP. A number of aspect refactorings have already been proposed [7, 8, 10, 11]. Some of these refactorings deal with cleaning up “bad smells” in aspects, while others deal with transforming object-oriented code into aspect-oriented code. An example is the Extract Method Cal ls refactoring, which removes all calls to a method from the base code and puts these in an advice. This refactoring can be used for transforming crosscutting method calls, like for instance an //outputToLog// method whose calls tend to be highly scattered, into an advice and corresponding pointcut. When refactoring a concern to an aspect, a pointcut must be written for this aspect. Pointcut languages like for instance the CARMA pointcut language allow specifying intensional (or “pattern-based”) pointcuts, so that the pointcut does not easily break when the base code is changed [5]. While existing aspect refactoring techniques also automatically generate a pointcut, they typically only provide an enumerative pointcut, which is fragile with respect to evolution of the base program. Turning this pointcut into a pattern-based pointcut is left to be done manually by the developer. ===== Subject ===== In our research [2, 3, 6] we conducted experiments on discovering patterns in source code that can be exploited to write pointcuts that better support evolution. The pointcuts are limited to the static joinpoint model of the program. Our tools are therefore unable to generate pointcuts that use control flow constructs or that use dynamic values in the system. The following picture illustrates our approach: {{ teaching:thesis0607:proposals:ilp_for_pointcuts_overview.png }} The FactGen tool generates the background information and target joinpoints. The tuned ILP algorithm than induces a more robust pointcut describing the target joinpoints. The goal of the thesis is to extend our approach and also take into account dynamic program information (e.g. values, history) for generating pointcuts. ===== Objectives of the Apprenticeship and Thesis ===== The apprenticeship and thesis is a joint proposal of the SSEL and PROG labs. During the apprenticeship, the student will develop the tools and implement the techniques needed to support facts of dynamic nature to support generating pattern-based pointcuts. The following concrete steps are expected: - Identify a dynamic joinpoint model that is suited for pointcut abstraction and write the tools (extension of existing tools) to generate background information for this model. A possible input could for instance be program traces. - Implement a technique to select positive example joinpoints for the ILP algorithm. - Conduct experiments to generate pattern-based pointcuts on a couple of realistic and interesting case-studies. ===== Prerequisites ===== The apprenticeship and thesis build on concepts from diverse courses in the curriculum. General knowledge on the following topics is required (either by having had a course on them, or taking one during the year): * Knowledge of Object-Oriented Software Development * Knowledge of Logic Programming ===== Environment ===== System and Software Engineering Lab, Vrije Universiteit Brussel, Brussels, Belgium. ===== References ===== [1] Aspect-Oriented Software Association. Aspect-oriented software development-tools and languages. http://aosd.net/tools.htm.\\ [2] Mathieu Braem, Kris Gybels, Andy Kellens, and Wim Vanderperren. Automated pattern-based pointcut generation. In Welf Lowe and Mario Sudholt, editors, Proc. of the 5th Int. Symp. on Software Composition, March 2006.\\ [3] Mathieu Braem, Kris Gybels, Andy Kellens, and Wim Vanderperren. Inducing evolution-robust pointcuts. In Proc. of ERCIM Workshop on Software Evolution, April 2006.\\ [4] Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts. Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999.\\ [5] Kris Gybels and Johan Brichau. Arranging language features for pattern-based crosscuts. In Mehmet Ak ̧sit, editor, Proc. 2nd Int’ Conf. on Aspect-Oriented Software Development (AOSD-2003), pages 60–69. ACM Press, March 2003.\\ [6] Kris Gybels and Andy Kellens. An experiment in using inductive logic programming to uncover pointcuts. In Kris Gybels, Stefan Hanenberg, Stephan Herrmann, and Jan Wloka, editors, European Interactive Workshop on Aspects in Software (EIWAS), September 2004.\\ [7] Stefan Hanenberg, Christian Oberschulte, and Rainer Unland. Refactoring of aspect-oriented software. In 4th Annual International Conference on Object-Oriented and Internet-based Technologies, Concepts, and Applications for a Networked World, 2003.\\ [8] Jan Hannemann, Gail Murphy, and Gregor Kiczales. Role-based refac- toring of crosscutting concerns. In Peri Tarr, editor, Proc. 4rd Int. Conf. on Aspect-Oriented Software Development (AOSD-2005), pages 135–146. ACM Press, March 2005.\\ [9] Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In Mehmet Ak ̧sit and Satoshi Matsuoka, editors, 11th European Conf. Object-Oriented Programming, volume 1241 of LNCS, pages 220–242. Springer Verlag, 1997.\\ [10] Ramnivas Laddad. Aspect-oriented refactoring. Two-part online article published at www.theserverside.com, dec 2003.\\ [11] Miguel Pessoa Monteiro. Catalogue of refactorings for aspectj. Technical Report UM-DI-GECSD-200401, Universidade Do Minho, 2004.\\