100 likes | 195 Vues
This paper explores refactoring aspectizable interfaces in AOP, highlighting benefits such as maintainability, understandability, size reduction, and modularity. It details concepts like aspects, joinpoints, pointcuts, weaving, and the process of refactoring. The study analyzes empirical results on class cohesion, interface coupling, and code maintainability in Java programs.
E N D
Refactoring the Aspectizable Interfaces: An Empirical Assessment Presenter: Patrick Joyce Authors: Paolo Tonella and Mariano Ceccato IEEE Transactions, Software Engineering, October 2005
Overview • What is Aspect-Oriented Programming (AOP)? • Concepts • Terminology • What are Aspectizable Interfaces? • How can we benefit from this design? • Maintainability • Understandability • Size Reduction • Modularity
Aspect-Oriented Programming • Goal: Separate orthogonal and principle concerns • Benefits • Collect “scattered” code into one maintainable unit • No original source code required to add/remove aspects • Example: class BarChart • Principle Concerns • LoadChart() • DisplayChart() • SaveChart() • Orthogonal Concern • Logging
Aspect-Oriented Programming • Aspect • Primary modularization unit • Represents an orthogonal concern • Joinpoint • A specific area of execution in an application • E.g., object instantiation, method call, variable declaration, etc. • Pointcut • A collection of joinpoints; specifies where the concern applies • E.g., (AspectJ) - pointcut callSetMethods(): call(void set*(..)); • Advice • The implementation of the aspects; defines how and where to implements the concern • Weaving • The process of combining the aspect code with the original application
Aspectizable Interfaces • Interface Roles • Collect abstract properties of the principal concern of the class • Collect transversal properties that crosscut the principal concern of the class • Non-Aspectizable Interfaces • Adhere to the first role • Example: Collection • Aspectizable Interfaces • Adhere to the second role • Examples: Serializable, Observable (note: normally end with “able”)
Refactoring Aspectizable Interfaces • Move interface properties to aspect • Attributes • Methods • Inner Classes • UNPLUG • Input: A.java, I.java • Output: A’.java, IA.aj
Refactoring Example: Observable • See Eclipse Project
Refactoring Analysis • Hypotheses • AOP code for aspectizable interfaces: • Is easier to maintain. • Is easier to understand. • Is significantly smaller in size. • Improves modularity. • Application • Refactor a large proportion of the standard Java library • Refactor three open source programs • Analysis Methods • (1,2) Empirical Maintenance Study • (3,4) Customized Metrics (UCLOC, OP, OCOH, ACOH, ICOUPL)
Refactoring Results • Class cohesion increased • Extracted methods are loosely connection with other class operations • Interface coupling decreased • Size remained untouched • Understandability increased • Maintainability remained similar • Possibly due to the relative size
Conclusion • Questions?