Refactoring of Crosscutting Concerns with Metaphor-Based Heuristics

It has been advocated that Aspect-Oriented Programming (AOP) is an effective technique to improve software maintainability through explicit support for modularising crosscutting concerns. However, in order to take the advantages of AOP, there is a need for supporting the systematic refactoring of crosscutting concerns to aspects. Existing techniques for aspect-oriented refactoring are too fine-grained and do not take the concern structure into consideration. This paper presents a metaphorbased classification of crosscutting concerns, which is driven by their manifested shapes through a system’s modular structure. Our categories provide an intuitive vocabulary for concern-oriented design flaws and identify the appropriate refactorings in terms of recurring crosscutting structures. On top of this classification, we define a suite of heuristic-based refactorings to guide the “aspectisation” of each concern category. We evaluate our technique by classifying concerns of 23 design patterns and by proposing refactorings to aspectise the appropriate ones.

The proposed metaphor-based classification are driven by heuristics rules. The heuristic rules use the numbers obtained by the application of a metric suite (previously published and tested) into each crosscutting concern. In our case study each pattern role was considered as a concern and thus the overall pattern classification depends on its respectives pattern roles. The spreadsheets below contain the metric-based evaluation of the design patterns.

Concern-oriented metrics [1, 2, 3, 4, 5, 6, 7, 8]:

  • NOA (Number of Attributes): Counts the number of class variables and fields of each class, interface or aspect.
  • NOO (Number of Operations): Counts the number of methods, constructors, and advice of each class or aspect.
  • CA (Concern Attrtibutes): Counts the number of attributes that contribute to the realisation of a certain concern
  • CO (Concern Operations): Counts the number of operations that participate in the implementation of a concern.
  • NOA% ((CA/NOA)*100): The percentual rate between the number of attributes related to the concern realisation and all the attributes within the component.
  • NOO% ((CO/NOO)*100): The percentual rate between the number of operations related to the concern realisation and all the operations within the component.
  • CDLOC (Concern Diffusion over Lines of Code): counts the number of transition points for each concern through the lines of code.
  • CDC (Concern Diffusion over Components): Counts the number of primary components whose main purpose is to contribute to the implementation of a concern.
  • VS (Vocabulary Size): The number of components.

References:

  1. Ceccato, M. and Tonella, P. “Measuring the Effects of Software Aspectization”. In proceedings of the 1st Workshop on Aspect Reverse Engineering, 2004.
  2. Ducasse, S.; Girba, T.; and Kuhn, A. “Distribution Map”. Proc. of the Int’l Conference on Software Maintenance (ICSM), pp. 203-212. Philadelphia, 2006.
  3. Eaddy, M.; Aho, A.; and Murphy, G. “Identifying, Assigning, and Quantifying Crosscutting Concerns”. Proc. of the Workshop on Assessment of Contemporary Modularization Techniques (ACoM), 2007.
  4. Figueiredo, E.; Sant'Anna, C.; Garcia, A.; Bartolomei, T.; Cazzola, W.; and Marchetto, A. "On the Maintainability of Aspect-Oriented Software: A Concern-Oriented Measurement Framework". In proceedings of the 12th European Conference on Software Maintenance and Reengineering (CSMR). Athens, Greece, 1-4 April 2008.
  5. Lopez-Herrejon, R. and Apel, S. “Measuring and Characterizing Crosscutting in Aspect-Based Programs: Basic Metrics and Case Studies”. Proc. of the Int’l Conference on Fundamental Approaches to Software Engineering (FASE), 2007.
  6. Sant’Anna, C., Figueiredo, E., Garcia, A, Lucena, C. “On the Modularity of Software Architectures: A Concern-Driven Measurement Framework”. Proc. of the European Conference on Software Architecture (ECSA). Madrid, 2007.
  7. Sant'Anna, C. et al. On the Reuse and Maintenance of Aspect-Oriented Software: An Assessment Framework. Proc. of Brazilian Symp. on Software Eng., 2003, 19-34.
  8. Wong, W.; Gokhale, S.; and Horgan, J. “Quantifying the Closeness between Program Components and Features”. Journal of Systems and Software, 2000.

You can find further informations at the paper or contacting the authors.

Bruno C. da Silva
Eduardo Figueiredo
Alessandro Garcia
Daltro Nunes