{'fraction_non_alphanumeric': 0.015347334410339256, 'fraction_numerical': 0.0, 'mean_word_length': 5.661290322580645, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Measuring Class Cohesion Using Internal and External Class Relationships

Class cohesion is a design quality that has a great impact on posterior development and maintenance of object-oriented systems. There have been much works on measuring class cohesion based on internal class relationships such as method-attribute referencing and internal method invocations. However, object-oriented systems involve many external class relationships carrying a functional context which should be also taken into account in measuring class cohesion. However, the existing works using internal relationships cannot measure cohesion of classes involving many external relationships. In this paper, we present a novel metric for measuring class cohesion based on both internal and external class relationships through an iterative process. We evaluate the metric by applying it to five applications — ArgoUML, jEdit, JHotDraw, JMeter, and Refactor, and validate the metric theoretically and statistically. The theoretical validation shows that the metric exhibits the required properties for cohesion metrics and the statistical validation shows that the metric captures a new aspect of class cohesion that has not been addressed by the existing works.