A Position-Aware Approach to Decomposing God Classes
Tianyi Chen, Yanjie Jiang, Fu Fan, Bo Liu, Hui Liu
Abstract
God classes are widely recognized as code smells, significantly impairing the maintainability and readability of source code. However, resolving the identified God classes remains a formidable challenge, and we still lack automated and accurate tools to resolve God classes automatically. To this end, in this paper, we propose a novel approach (called ClassSplitter) to decompose God classes. The key observation behind the proposed approach is that software entities (i.e., methods and fields) that are physically adjacent often have strong semantic correlations and thus have a great chance of being classified into the same class during God class deposition. We validate this hypothesis by analyzing 54 God class decomposition refactorings actually conducted in the wild. According to the observation, we measure the similarity between software entities by exploiting not only traditional code metrics but also their relative physical positions. Based on the similarity, we customize a clustering algorithm to classify the methods within a given God class, and each of the resulting clusters is taken as a new class. Finally, ClassSplitter allocates the fields of the God class to the new classes according to the field-access-based coupling between fields and classes. We evaluate ClassSplitter using 133 real-world God classes from open-source applications. Our evaluation results suggest that ClassSplitter could substantially improve the state of the art in God class decomposition, improving the average MoJoFM by 47%. Manual evaluation also confirmed that in most cases (77%) the solutions suggested by ClassSplitter were preferred by developers to alternatives suggested by the state-of-the-art baseline approach.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get 3045b613-3f46-497b-8e26-65ccdb9a69b4Related papers
- Deep Learning Based Feature Envy Detection Boosted by Real-World ExamplesBo Liu, Hui Liu, Guangjie Li, Nan Niu et al.FSE 2023 · 19 citations
- Enhancing LLMs with Staged Grouping and Dehallucination for Header File DecompositionYue Wang, Jiaxuan Sun, Yanzhen Zou, Bing XieASE 2025
- Identifying Key Classes for Initial Software Comprehension: Can We Do It Better?Weifeng Pan, Xin Du, Ming Hua, Dae-Kyoo Kim et al.ICSE 2023 · 6 citations
- PairSmell: A Novel Perspective Inspecting Software Modular StructureChenxing Zhong, Daniel Feitosa, Paris Avgeriou, Huang Huang et al.ICSE 2025
- SSAR: A Novel Software Architecture Recovery Approach Enhancing Accuracy and ScalabilityWei Ding, Ran Mo, Chaochao Wu, Haopeng SongICSE 2026
