[论文解读] A Systematic Aspect-Oriented Refactoring and Testing Strategy, and its Application to JHotDraw
本文提出了一种系统化、以测试为导向的重构策略——Bettar,用于通过AspectJ将遗留的面向对象系统迁移至面向切面编程。该策略应用于JHotDraw,展示了行为保持不变的重构、故障模型和充分性准则,实现了模块化与可演化性的提升,并完成了经过验证的、增量式的横切关注点迁移。
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.
研究动机与目标
- 解决缺乏系统化、行为保持不变的策略来将遗留系统重构为面向切面编程的问题。
- 开发一种测试策略,确保在迁移至面向切面实现过程中行为保持不变。
- 评估面向切面语言(如AspectJ)在大型系统中重构真实世界横切关注点的适用性。
- 提供一个公开可用的开源系统,包含原始版本与面向切面版本,以支持实验研究。
- 通过识别横切关注点类型与可用语言特性之间的差距,为面向切面语言设计做出贡献。
提出的方法
- 应用‘切面挖掘’技术,如扇入分析和克隆检测,识别遗留代码中的横切关注点。
- 采用系统化、分步式的过程设计切面:识别关注点、评估散射与纠缠、设计切面,并通过测试进行验证。
- 引入面向切面的故障模型,并定义测试充分性准则,以确保重构过程中行为保持不变。
- 将重构后的系统(AJhotDraw)实现为JHotDraw的面向切面版本,使用AspectJ进行织入。
- 对选定的横切关注点进行个案研究,通过验证测试比较重构前后的实现。
- 从案例研究中抽象出通用重构模式,并将横切关注点类型映射到特定的面向切面语言特性和模型。
实验结果
研究问题
- RQ1如何设计一种系统化、行为保持不变的重构策略,用于将遗留的面向对象系统迁移至面向切面编程?
- RQ2在面向切面重构过程中,为确保行为保持不变,需要哪些测试充分性准则和故障模型?
- RQ3哪些类型的横切关注点难以用现有面向切面语言表达,语言特性如何影响重构的可行性?
- RQ4面向切面重构在多大程度上提升了真实世界系统(如JHotDraw)的模块化、可演化性和可重用性?
- RQ5如何通过公开可用的双版本系统(原始版本与面向切面版本)支持软件演化领域的对比实验研究?
主要发现
- Bettar策略成功实现了对JHotDraw的系统化、增量式重构,生成了AJhotDraw,同时保持了可观察的行为不变。
- 所提出的面向切面故障模型和测试充分性准则,为验证迁移过程中行为保持不变提供了结构化方法。
- JHotDraw中的多个横切关注点(如撤销/重做和布局管理)被成功重构为切面,提升了模块化程度并减少了代码散射。
- 研究揭示了AspectJ在联合点模型和特性集方面对某些复杂横切关注点存在局限性,提示了面向切面语言增强的方向。
- AJhotDraw的创建作为一个公开可用的、与JHotDraw并列的对比版本,为未来关于面向切面重构优势的实验研究提供了支持。
- 对重构的分析表明,某些关注点更适合特定的面向切面语言特性,支持对关注点类型与语言能力进行分类整理的必要性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。