SOFTWARE—PRACTICE AND EXPERIENCE
Softw. Pract. Exper. 2008; 38:361–396
Published online 21 August 2007 in Wiley InterScience (www.interscience.wiley.com). DOI: 10.1002/spe.835
An illustrative example of
refactoring object-oriented
source code with
aspect-oriented mechanisms
Miguel P. Monteiro
1
and Jo˜ ao M. Fernandes
2, ∗, †
1
Departamento de Inform´ atica, Faculdade de Ciˆ encias e Tecnologia da
Universidade Nova de Lisboa, 2829-516 Caparica, Portugal
2
Departamento de Inform´ atica & CCTC, Universidade do Minho,
4710-057 Braga, Portugal
SUMMARY
This paper describes a refactoring process that transforms a Java source code base into a functionally
equivalent AspectJ source code base. The process illustrates the use of a collection of refactorings for
aspect-oriented source code, covering the extraction of scattered implementation elements to aspects, the
internal reorganization of the extracted aspects and the extraction of commonalities to super-aspects.
Copyright
©
2007 John Wiley & Sons, Ltd.
Received 12 May 2006; Revised 29 April 2007; Accepted 1 May 2007
KEY WORDS: refactoring; aspect-oriented programming; design patterns
1. INTRODUCTION
Refactoring [1] and aspect-oriented programming (AOP) [2] are two techniques that contribute to
deal with the problems of continuous evolution of software. This paper shows how both techniques
can be combined to improve the structure of an existing system. In doing so, it also illustrates
current notions of good style for AOP.
∗
Correspondence to: Jo˜ ao M. Fernandes, Departamento de Inform´ atica, Universidade do Minho, 4710-057 Braga, Portugal.
†
E-mail: jmf@di.uminho.pt
Contract/grant sponsor: FCT
Contract/grant sponsor: FEDER; contract/grant number: POSC/EIA/60189/2004
Copyright 2007 John Wiley & Sons, Ltd.