Skip to main content
QUICK REVIEW

[Paper Review] A Semantic-Based Approach for Detecting and Decomposing God Classes

Lee Junha, Donghun Lee|arXiv (Cornell University)|Apr 9, 2012
Natural Language Processing Techniques21 references3 citations
TL;DR

This paper proposes a semantic-based approach to detect God classes and decompose their responsibilities by analyzing method interactions and class relationships, using semantic similarity derived from inter-class and intra-class method interactions. The method achieves a high F-measure of 0.919 on JMeter v2.5.1, demonstrating strong accuracy in identifying and decomposing responsibilities without relying on internal attribute-method references.

ABSTRACT

Cohesion is a core design quality that has a great impact on posterior development and maintenance. By the nature of software, the cohesion of a system is diminished as the system evolves. God classes are code defects resulting from software evolution, having heterogeneous responsibilities highly coupled with other classes and often large in size, which makes it difficult to maintain the system. The existing work on identifying and decomposing God classes heavily relies on internal class information to identify God classes and responsibilities. However, in object-oriented systems, responsibilities should be analyzed with respect to not only internal class information, but also method interactions. In this paper, we present a novel approach for detecting God classes and decomposing their responsibilities based on the semantics of methods and method interactions. We evaluate the approach using JMeter v2.5.1 and the results are promising.

Motivation & Objective

  • Address the limitations of existing God class detection techniques that rely solely on internal class structure and attribute-method relationships.
  • Improve the accuracy of responsibility identification in God classes by incorporating semantic analysis of method interactions across classes.
  • Enable systematic detection and decomposition of God classes at both design and code levels without requiring detailed attribute references.
  • Provide a robust, semantic-driven method for refactoring large, highly cohesive classes that are difficult to maintain due to mixed responsibilities.

Proposed method

  • Measure semantic similarity of methods using inter-class method interactions, intra-class method interactions, and types of class relationships.
  • Apply Resnik’s semantic similarity taxonomy to analyze inter-class method interactions, refining results with intra-class interactions and class relationship types.
  • Construct weighted graphs based on the refined semantic similarity scores to represent God class structures and their responsibilities.
  • Detect God classes using metrics such as NOM (Number of Methods), CBO (Couple of Base Classes), and IC (Inheritance Coupling), combined with semantic similarity thresholds.
  • Decompose responsibilities by clustering methods based on their semantic similarity, using a threshold derived from the mean and standard deviation of Inter-Semantic Similarity (ISS).
  • Use precision, recall, and F-measure to evaluate the accuracy of responsibility detection by comparing automatically identified responsibilities with manually reviewed ground truth.

Experimental results

Research questions

  • RQ1Can semantic similarity based on method interactions and class relationships effectively detect God classes that are missed by traditional internal-structure-based approaches?
  • RQ2To what extent can semantic analysis of method interactions improve the accuracy of responsibility identification in God classes compared to attribute-based methods?
  • RQ3How effective is the proposed method in decomposing God class responsibilities into coherent, reusable classes?
  • RQ4What is the impact of varying threshold values on the F-measure of responsibility detection across different God classes?
  • RQ5Can the approach be applied effectively at both design and code levels without requiring detailed attribute-method references?

Key findings

  • The proposed approach achieved an average F-measure of 0.919 across detected God classes in JMeter v2.5.1, indicating high accuracy in responsibility detection.
  • The responsibilities of the $MenuFactory$ and $ProxyControl$ classes were identified exactly as per manual review, demonstrating precise detection capability.
  • The F-measure remained consistently high (above 0.9) in the threshold range of 1.3 to 1.5, indicating robust performance under varying configuration settings.
  • The results showed high deviation in ISS (Inter-Semantic Similarity), suggesting a strong likelihood of successful decomposition for detected God classes.
  • The method does not require attribute-method reference data, enabling its application at the design level where such details are unavailable.
  • The approach outperforms traditional cohesion metrics by incorporating behavioral semantics through method interaction analysis, reducing subjectivity in God class detection.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.