[Paper Review] A Systematic Aspect-Oriented Refactoring and Testing Strategy, and its Application to JHotDraw
This paper proposes a systematic, testing-driven refactoring strategy—Bettar—for migrating legacy object-oriented systems to aspect-oriented programming using AspectJ. It applies the strategy to JHotDraw, demonstrating behavior-conserving refactoring, a fault model, and adequacy criteria, resulting in improved modularity and evolvability with validated, incremental migration of crosscutting concerns.
Aspect oriented programming aims at achieving better modularization for a system's crosscutting concerns in order to improve its key quality attributes, such as evolvability and reusability. Consequently, the adoption of aspect-oriented techniques in existing (legacy) software systems is of interest to remediate software aging. The refactoring of existing systems to employ aspect-orientation will be considerably eased by a systematic approach that will ensure a safe and consistent migration. In this paper, we propose a refactoring and testing strategy that supports such an approach and consider issues of behavior conservation and (incremental) integration of the aspect-oriented solution with the original system. The strategy is applied to the JHotDraw open source project and illustrated on a group of selected concerns. Finally, we abstract from the case study and present a number of generic refactorings which contribute to an incremental aspect-oriented refactoring process and associate particular types of crosscutting concerns to the model and features of the employed aspect language. The contributions of this paper are both in the area of supporting migration towards aspect-oriented solutions and supporting the development of aspect languages that are better suited for such migrations.
Motivation & Objective
- Address the lack of systematic, behavior-conserving strategies for refactoring legacy systems toward aspect-oriented programming.
- Develop a testing strategy that ensures behavioral conservation during migration to aspect-oriented implementations.
- Evaluate the suitability of aspect languages (e.g., AspectJ) for refactoring real-world crosscutting concerns in large-scale systems.
- Provide a publicly available open-source comparison between original and aspect-oriented versions of a system for experimental research.
- Contribute to aspect language design by identifying gaps between crosscutting concern types and available language features.
Proposed method
- Apply 'aspect mining' techniques such as fan-in analysis and clone detection to identify crosscutting concerns in legacy code.
- Design aspects using a systematic, step-by-step process: identify concerns, assess scattering/tangling, design aspects, and validate with tests.
- Introduce an aspect-oriented fault model and define test adequacy criteria to ensure behavioral conservation during refactoring.
- Implement the refactored system (AJhotDraw) as an aspect-oriented version of JHotDraw, using AspectJ for weaving.
- Conduct individual case studies on selected crosscutting concerns, comparing pre- and post-refactoring implementations with validating tests.
- Abstract generic refactorings from the case study and map types of crosscutting concerns to specific aspect language features and models.
Experimental results
Research questions
- RQ1How can a systematic, behavior-conserving refactoring strategy be designed for migrating legacy object-oriented systems to aspect-oriented programming?
- RQ2What testing adequacy criteria and fault models are necessary to ensure behavioral conservation during aspect-oriented refactoring?
- RQ3Which types of crosscutting concerns are difficult to express in existing aspect languages, and how do language features affect refactoring feasibility?
- RQ4To what extent do aspect-oriented refactorings improve modularity, evolvability, and reusability in real-world systems like JHotDraw?
- RQ5How can a publicly available, dual-version system (original and aspect-oriented) support comparative experimental research in software evolution?
Key findings
- The Bettar strategy successfully enabled systematic, incremental refactoring of JHotDraw into AJhotDraw while preserving observable behavior.
- The proposed aspect-oriented fault model and test adequacy criteria provided a structured approach to validating behavioral conservation during migration.
- Several crosscutting concerns in JHotDraw—such as undo/redo and layout management—were successfully refactored into aspects, improving modularity and reducing code scattering.
- The study revealed limitations in AspectJ’s joint point model and feature set for certain complex crosscutting concerns, suggesting areas for aspect language enhancement.
- The creation of AJhotDraw as a publicly available, side-by-side comparison with JHotDraw enables future experimental research on the benefits of aspect-oriented refactoring.
- The analysis of refactorings revealed that certain concerns are better suited to specific aspect language features, supporting the need for cataloging concern types and language capabilities.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.