An Investigation of Design Level Class Cohesion Metrics

An Investigation of Design Level
Class Cohesion Metrics

Kuljit Kaur and Hardeep Singh
Department of Computer Science and Engineering, Guru Nanak Dev University, Amritsar, India
 
Abstract: Design level class cohesion metrics are based on the assumption that if all the methods of a class have access to similar parameter types then they all process closely related information. A class with a large number of parameter types common in its methods is more cohesive than a class with less number of parameter types common in its methods. In this paper we review the design level class cohesion metrics with a special focus on metrics which use similarity of parameter types of methods of a class as the basis of its cohesiveness. Basically three metrics fall in this category: Cohesion among Methods of a Class (CAMC), Normalized Hamming Distance (NHD), and Scaled NHD (SNHD). Keeping in mind the anomalies in the definitions of the existing metrics, a variant of the existing metrics is introduced.  It is named NHD Modified (NHDM). A major point of difference is that the NHD metric counts a disagreement only if class methods taken as pairs disagree on a parameter type that one method uses but the other method, in the pair, does not use. It ignores the case when both methods of a pair do not use a parameter type. NHD indirectly counts it as an agreement, but NHDM considers such a case as a disagreement. An automated metric collection tool is used to collect the metrics data from an open source Java based software program containing 884 classes. Metrics data is then subjected to statistical analysis. The NHDM metric shows the maximum amount of variation in data values in comparison to other metrics in the group. NHDM is strongly correlated with CAMC. Unlike the previous studies, no significant correlation is found in CAMC and NHD.


Keywords: Design metrics, class cohesion metrics, product quality, cohesion among methods of a class, normalized hamming distance, scaled NHD, and NHD modified.

Received September 10, 2009; accepted March 9, 2010

Read 2974 times Last modified on Thursday, 27 October 2011 05:57
Share
Top
We use cookies to improve our website. By continuing to use this website, you are giving consent to cookies being used. More details…