Abstract

Class cohesion is an important quality attribute that has an impact on other quality attributes such understandability, testability, and maintainability. Therefore, classes with low cohesion should be refactored in order to improve their overall qualities. Many cohesion metrics have been introduced in the literature to automatically assess the quality of the class and support refactoring activities. Most existing metrics measure the class cohesion based on how the methods of a class are internally related to each other, while a few metrics measure the class cohesion based on how the methods are externally used by the clients of the class. Unfortunately, the existing client-based cohesion metrics cannot automatically support refactoring techniques such as the Extract Class refactoring. Therefore, this article proposes a new client-based cohesion metric that can be used to automatically identify Extract Class refactoring opportunities. The proposed metric is theoretically evaluated by proving the compliance of the metric to the mathematical cohesion properties, while it is empirically evaluated by conducting a large case study on three systems to compare the metric with other cohesion metrics. Finally, the paper introduces and evaluates an Extract Class refactoring approach based the proposed cohesion metric.

Highlights

  • S OFTWARE developers strive hard to design classes with high quality

  • We refer to this kind of similarity as client similarity between methods and we call the proposed metric COHESION BASED ON CLIENT SIMILARITY BETWEEN METHODS (CCSM) which stands for Cohesion based on Client Similarity between Methods

  • Our results indicate that CCSM is potentially useful and may offer benefits not offered by the other metrics

Read more

Summary

INTRODUCTION

S OFTWARE developers strive hard to design classes with high quality. Class cohesion is one of the most important quality attributes that influences the maintainability of the class [1], [2]. Most of existing class cohesion metrics (e.g, [6]–[10] ) fall into the first category in which class cohesion is measured based on information extracted from the internal elements (methods and attributes) of the class regardless the other classes in the system. The new metric measures the cohesion of a class based on the similarities (in terms of clients’ usage) between each pair of methods including the non-public methods. We refer to this kind of similarity as client similarity between methods and we call the proposed metric CCSM which stands for Cohesion based on Client Similarity between Methods.

RELATED WORK
INTERNAL VIEW-BASED APPROACHES
INTERNAL AND EXTERNAL VIEW-BASED APPROACHES
MODEL DEFINITION Definition 1
METRIC DEFINITION
THEORETICAL EVALUATION OF CCSM
EMPIRICAL EVALUATION
CONSIDERED METRICS We select the following metrics in our case study
RESULTS AND DISCUSSION
USING CCSM TO SUPPORT EXTRACT CLASS REFACTORING
THE LIMITATION OF CCC IN SUPPORTING THE EXTRACT CLASS REFACTORING
AN EXAMPLE OF APPLICATION
CONCLUSION AND FUTURE WORK
#Methods CCSM
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call