Refactorings -behavior-preserving source-code transformations -allow the automated redistribution of pieces of source code over the class hierarchy. The underlying objective is to improve the quality of the software system, with regard to future maintenance and development activities. Unfortunately, while it is clear that we can use refactorings to restructure software systems, it is unclear how to use them in order to improve specific quality attributes that are indicators for a good design. We start from the assumption that coupling and cohesion characteristics may serve as indicators for the optimal distribution of responsiblities over the class hierarchies. Thus, rather than saying that refactoring will improve the design, we aim for a less ambitious goal of improving the coupling and cohesion. Cohesion then corresponds to the degree to which elements of a class belong together, and coupling is the strength of association established by a connection from one class to another [11] . Therefore, in this paper we analyze under which conditions applications of refactorings improve specific coupling and cohesion dimensions. Guidelines for applying the refactorings under these conditions are composed, and validated on an open source software system regarding both improvement and applicability. The paper is organized as follows. Section 1 discusses which guidelines optimize the improvement of coupling and cohesion for specific refactorings. Section 2 elaborates on a validation of these guidelines regarding their improvement and applicability. Section 3 discusses lessons learned during the detection of the refactoring opportunities and their resolution. Section 4 outlines future research and related work. Finally, Section 5 summarizes the contributions of this work. Refactoring opportunities are locations in the source where a) there is a need for improvement regarding a quality attribute; b) a refactoring can be applied that will reorganize the code while preserving the behavior of the software system; and c) the application of the refactoring will indeed improve the quality attribute. To be able to recognize opportunities for improving coupling and cohesion, we analyze how refactorings affect these quality attributes. First, we will describe the concrete dimensions in which these two abstract quality attributes can be divided. Second, we introduce the refactorings we set out to investigate. Finally, we explain how we can map these refactoring postconditions on coupling and cohesion metrics.
Bois et al. REF developed practical guidelines in order to applying to refactoring methods to improve coupling and cohesion characteristics and validated these guidelines on an open source software system.
Refactoring - improving coupling and cohesion of existing code
11th Working Conference on Reverse Engineering
11th Working Conference on Reverse Engineering
Computer Science