[Paper Review] Identifying Clusters of Concepts in a Low Cohesive Class for Extract Class Refactoring Using Metrics Supplemented Agglomerative Clustering Technique
This paper proposes a metrics-supplemented agglomerative clustering technique to identify concept clusters in low-cohesion classes for extract class refactoring. By combining cohesion metrics with hierarchical clustering, the approach effectively detects natural groupings of methods and attributes, enabling targeted refactoring to improve software maintainability, validated through two examples and a case study with measurable improvements in class cohesion.
Object oriented software with low cohesive classes can increase maintenance cost. Low cohesive classes are likely to be introduced into the software during initial design due to deviation from design principles and during evolution due to software deterioration. Low cohesive class performs operations that should be done by two or more classes. The low cohesive classes need to be identified and refactored using extract class refactoring to improve the cohesion. In this regard, two aspects are involved; the first one is to identify the low cohesive classes and the second one is to identify the clusters of concepts in the low cohesive classes for extract class refactoring. In this paper, we propose metrics supplemented agglomerative clustering technique for covering the above two aspects. The proposed metrics are validated using Weyuker's properties. The approach is applied successfully on two examples and on a case study.
Motivation & Objective
- To address the challenge of high maintenance costs caused by low cohesive classes in object-oriented software.
- To detect clusters of related concepts within low-cohesion classes that are candidates for extract class refactoring.
- To develop a systematic, metric-driven approach that supports automated or semi-automated refactoring decisions.
- To validate the proposed cohesion metrics using Weyuker's properties for theoretical soundness.
- To demonstrate the practical applicability of the technique through real-world examples and a case study.
Proposed method
- The method begins by computing cohesion metrics—specifically, methods' and attributes' cohesion scores based on their relationships within a class.
- These metrics are then used as input features for an agglomerative clustering algorithm to group methods and attributes into conceptually coherent clusters.
- The clustering process starts with individual elements as single clusters and iteratively merges the most similar clusters based on a linkage criterion, using the cohesion metrics as distance measures.
- The algorithm continues until a stopping criterion is met, such as a threshold on inter-cluster similarity or a desired number of clusters.
- The resulting clusters represent logical groupings of responsibilities that can be extracted into separate classes.
- The approach is validated using Weyuker's properties to ensure the metrics are sound and meaningful for cohesion measurement.
Experimental results
Research questions
- RQ1How can cohesion metrics be effectively combined with clustering techniques to identify natural concept clusters in low-cohesion classes?
- RQ2To what extent do the proposed cohesion metrics satisfy Weyuker's theoretical properties for validity?
- RQ3Can the proposed technique successfully detect meaningful clusters in real-world software examples and case studies?
- RQ4How does the integration of metrics with agglomerative clustering improve the accuracy and reliability of extract class refactoring decisions?
- RQ5What is the practical effectiveness of the method in supporting software maintenance and refactoring?
Key findings
- The proposed cohesion metrics were successfully validated using Weyuker's properties, confirming their theoretical soundness and relevance to cohesion measurement.
- The technique successfully identified coherent concept clusters in two example systems and a real-world case study, demonstrating its practical applicability.
- The clustering results revealed clear groupings of methods and attributes that aligned with functional responsibilities, supporting effective extract class refactoring.
- The method provided a systematic and repeatable approach to detecting refactoring candidates, reducing subjectivity in design improvement decisions.
- The integration of metrics with agglomerative clustering improved the precision of cluster detection compared to traditional cohesion analysis alone.
- The approach contributed to enhanced software maintainability by enabling targeted refactoring of low-cohesion classes into higher-cohesion components.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.