Abstract
A commonly observed ambiguity of a class is simply a reflection of multiple methods’ implementation within an individual class. The process of Extract Class refactoring is, therefore, used to separate the different responsibilities of a class into different classes. A major limitation in existing approaches of the Extract Class refactoring is based on factors that are internal to the class, i.e., structural and semantic relationships between methods, in order to identify and separate the responsibilities of the class which are inadequate in many cases. Thus, we propose a novel approach that exploits the clients of the class to support the Extract Class refactoring. The importance of this approach lies in its usefulness to support existing approaches since it involves factors external to the class, i.e., the clients. Moreover, an extensive empirical evaluation is presented to support the proposed method through the utilization of real classes selected from two open source systems. The result shows the potential of our proposed approach and usefulness that leads to an improvement in the quality of the considered classes.
Highlights
One of the most common design issues in object-oriented systems is having a class with many responsibilities
To overcome the above issue, this study proposes a novel approach that performs the Extract Class refactoring based on the similarities in terms of clients between the methods of the class in question
CBCS computes the similarities between each pair of methods in the class in order to measure the class cohesion while CCC does not, and cohesion metrics that compute the similarities between the methods are better in identifying the non-cohesive methods that need to be separated into different classes [30]
Summary
One of the most common design issues in object-oriented systems is having a class with many responsibilities. To overcome the above issue, this study proposes a novel approach that performs the Extract Class refactoring based on the similarities in terms of clients between the methods of the class in question. The proposed approach can be more beneficial than the traditional refactoring techniques that consider the internal view of the class when performing the extract class refactoring. It identifies the different responsibilities of a class based on the usage of its clients.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have