Detection of God Class Smells in PHP Systems Using Object-Oriented Metrics
DOI:
https://doi.org/10.25126/jitecs.2026112892Abstract
Software maintainability becomes difficult when object-oriented systems contain God Class code smells, where a single class handles excessive responsibilities and controls large portions of system behavior. Most existing God Class detection approaches use metric thresholds developed for statically typed languages such as Java, which may not accurately represent the architectural characteristics of dynamically typed PHP systems. This problem can reduce software maintainability, increase system complexity, and complicate future development and testing activities. This study applies a quantitative empirical research approach to evaluate metric-based God Class detection in PHP systems. Twelve open-source PHP projects containing 7,866 classes were collected from GitHub and analyzed using the PDepend static analysis tool. The extracted object-oriented metrics included Weighted Methods per Class (WMC), Number of Public Methods (NPM), Depth of Inheritance Tree (DIT), and Lines of Code (LOC). A class was classified as a God Class when at least three out of four threshold values were exceeded. The detection results were validated using statistical analysis, K-Means clustering, machine learning consistency validation, PHPMD comparison, and expert manual validation. The results identified 421 God Classes and showed that WMC, NPM, and LOC are strong indicators of God Class behavior in PHP systems, while DIT has lower influence due to framework-based inheritance structures. The study demonstrates that metric-based detection can effectively identify maintainability problems in PHP applications and provides a foundation for future PHP-specific threshold development.
Downloads
References
1. M. Alenezi, A. Agrawal, and K. Chaturvedi, “A systematic literature review on machine learning techniques for code smell detection,” IEEE Access, vol. 9, pp. 154594–154612, 2021.V.
2. N. A. A. Khleel and K. Nehéz, “Improving accuracy of code smells detection using machine learning with data balancing techniques,” The Journal of Supercomputing, vol. 80, pp. 21048–21093, 2024.
3. Z. Li, P. Liang, and P. Avgeriou, “Architectural technical debt identification based on machine learning,” Journal of Systems and Software, vol. 165, Art. no. 110566, 2020.
4. J. Pantiuchina, A. Zaidman, and G. Bavota, “Improving code review effectiveness through code smell awareness,” Empirical Software Engineering, vol. 25, no. 5, pp. 3996–4033, 2020.
5. R. S. Rao, S. Dewangan, A. Mishra, and M. Gupta, “Dealing with class imbalance in code smell severity detection using PCA-based feature selection,” Scientific Reports, vol. 13, Art. no. 16245, 2023.
6. A. Rio and F. Brito e Abreu, “PHP code smells in web applications: Evolution, survival, and anomalies,” Journal of Systems and Software, vol. 200, Art. no. 111644, 2023.
7. R. Sandouka and H. Aljamaan, “Cross-project code smell detection using machine learning techniques,” Applied Sciences, vol. 12, no. 18, Art. no. 9345, 2022.
8. J. A. Santos, R. Oliveira, and E. Figueiredo, “On the relationship between code smells and software maintainability,” Information and Software Technology, vol. 137, Art. no. 106598, 2021.
9. A. Tahir, G. Rasool, and M. A. Alqarni, “Ensemble learning approach for software code smell detection,” IEEE Access, vol. 10, pp. 51234–51247, 2022.
10. R. Verdecchia, F. Ricca, and M. Torchiano, “An empirical study on the distribution and evolution of code smells in open-source systems,” Software Quality Journal, vol. 29, pp. 1387–1412, 2021.
11. P. S. Yadav, R. S. Rao, A. Mishra, and M. Gupta, “Machine learning-based methods for code smell detection: A survey,” Applied Sciences, vol. 14, no. 14, Art. no. 6149, 2024.
12. Y. Zhang, S. Wang, and D. Lo, “Deep learning-based code smell detection,” Information and Software Technology, vol. 144, Art. no. 106765, 2022.
13. A. Kaur, P. Singh, and H. Singh, “Software metrics-based prediction of God Class code smell using classification models,” Journal of King Saud University – Computer and Information Sciences, vol. 33, no. 9, pp. 1036–1045, 2021.
14. M. Y. Mhawish and M. Gupta, “Predicting code smells using machine learning techniques and software metrics,” Journal of Computer Science and Technology, vol. 35, no. 6, pp. 1234–1252, 2020.
15. F. Palomba, G. Bavota, M. Di Penta, and R. Oliveto, “Exploring the impact of code smells on software change-proneness,” IEEE Transactions on Software Engineering, vol. 46, no. 5, pp. 493–509, 2020.
16. T. Sharma and D. Spinellis, “A survey on software smells,” Journal of Systems and Software, vol. 138, pp. 158–173, 2020.
17. M. Ribeiro, E. Figueiredo, and A. Garcia, “Investigating the persistence of code smells in evolving software systems,” Empirical Software Engineering, vol. 26, pp. 1–38, 2021.
18. J. Gao, H. Li, and T. Chen, “An empirical analysis of object-oriented metrics for detecting God Class design smell,” Software Quality Journal, vol. 30, pp. 845–872, 2022.
19. M. Aljamaan and R. Sandouka, “A systematic review on software code smells,” International Journal of Electrical and Computer Engineering, vol. 15, no. 3, pp. 3010–3027, 2025.
20. F. Fontana, V. Ferme, and M. Zanoni, “Automatic detection of bad smells in code: An experimental assessment,” Journal of Object Technology, vol. 15, no. 1, pp. 1–38, 2021.
21. M. Zakeri-Nasrabadi, S. Parsa, E. Esmaili, and F. Palomba, “A systematic literature review on the code smells datasets and validation mechanisms,” arXiv preprint arXiv:2306.01377, 2023.
22. B. Aljohani, “A novel framework for code smell detection via dynamic analysis,” PeerJ Computer Science, vol. 12, Art. no. e3642, 2026
23. A. Siddiqui, A. Hussain, and A. Ali, “A comparative analysis of code smell detection,” Journal of Computer and Information Sciences, vol. 5, no. 4, pp. 44–58, 2025.
24. R. Maini and P. Gupta, “An optimization-based code smell refactoring sequencing approach,” Journal of Computational and Cognitive Engineering vol. 3, no. 2, pp. 101–116, 2024
25. M.W.Schmid, “PDepend: PHP Depend,” Available: https://pdepend.org. Accessed: Jan. 2026
26. M. Rahmaty, “Machine learning with big data to solve real-world problems”.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Journal of Information Technology and Computer Science

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Creative Common Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).








