metrics for class cohesion and similarity between methods
Class cohesion is one of the desirable properties in object oriented designs. But, designers and managers need a good metric for this property to help them evaluate, compare and choose among various possible solutions to a given problem. In this paper, we will present a new metric for class cohesion based on similarity between the methods of a class. Cohesion metrics developed in previous researches have made vital contributions in the area; however, they are subject to some criticisms. This research is based on the same theoretical foundations and addresses some of the drawbacks in previous works. The theory behind similarity of methods is discussed, and then the notion is used to develop a metric for the degree of similarity between a pair of methods in a class. This metric will be extended further to develop a new metric for class cohesion. Next, the developed cohesion metric is evaluated with Weyuker's set of properties for measurement followed by use of the metrics with some empirical data from a small application developed for student class project along with data collection tool for computing the metrics. Our empirical validation deals with specific examples of classes to show that the new metric is more powerful than LCOM, one of the basic metrics for lack of cohesion in class, and CAMC, another metric for class cohesion. Moreover, it shows how the new metric reflects the intuition of class cohesion and discriminates against classes for which these metrics consider equally cohesive or non-cohesive.
metrics classes cohesion similarity methods complexity