Abstract
Code Smell is a term that indicates flaws in design and coding practice. God Class is a type of code smell that shows an irregular distribution of functionalities in large-sized classes. God Classes are less cohesive and more coupled in nature, thereby increasing software maintenance efforts and costs. Refactoring all such classes can disturb other related classes with code smell instances, puzzle the developers, and increase the refactoring budget. This paper proposes an automated method to prioritize God Class smell-associated classes with the fuzzy inference system. The fuzzy inference system is used to fuzzy the selected criteria—number of code smell instances, type of code smells, and changes in history. For effective refactoring, first, we moderate the dataset with the CodeMR tool and then highlight that the prioritization criteria are imperative after detecting code smells. Using five metric-based heuristics, a comparative result analysis is done to determine the fore reason for correlation (40–43%) with our results and the gravity of our prioritization criteria. Finally, we provide a severity index of classes with five type classifications and evaluate runtime performance (in seconds) to improve quality.
Similar content being viewed by others
Data availability
Available on request.
References
Fowler, M.; Beck, K.; Brant, J.; Opdyke, W.: Refactoring: Improving the Design of Existing Code (2002)
Doğan, E.; Tüzün, E.: Towards a taxonomy of code review smells. Inf. Softw. Technol.Softw. Technol. (2022). https://doi.org/10.1016/j.infsof.2021.106737
Shahidi, M.; Ashtiani, M.; Zakeri-Nasrabadi, M.: An automated extract method refactoring approach to correct the long method code smell. J. Syst. Softw.Softw. 187, 111221 (2022). https://doi.org/10.1016/j.jss.2022.111221
Morales, R.; Soh, Z.; Khomh, F.; Antoniol, G.; Chicano, F.: On the use of developers’ context for automatic refactoring of software anti-patterns. J. Syst. Softw.Softw. 128, 236–251 (2017). https://doi.org/10.1016/j.jss.2016.05.042
Palomba, F.; Bavota, G.; Di Penta, M.; Fasano, F.; Oliveto, R.; De Lucia, A.: A large-scale empirical study on the lifecycle of code smell co-occurrences. Inf. Softw. Technol.Softw. Technol. 99, 1–10 (2018). https://doi.org/10.1016/j.infsof.2018.02.004
Sharma, T.; Efstathiou, V.; Louridas, P.; Spinellis, D.: Code smell detection by deep direct-learning and transfer-learning. J. Syst. Softw.Softw. (2021). https://doi.org/10.1016/j.jss.2021.110936
Olbrich, S.M.; Cruzes, D.S.; Sjoberg, D.I.K.: Are all code smells harmful? A study of God Classes and Brain Classes in the evolution of three open source systems. In: 2010 IEEE International Conference on Software Maintenance. pp. 1–10. IEEE (2010)
Vidal, S.A.; Marcos, C.; Díaz-Pace, J.A.: An approach to prioritize code smells for refactoring. Autom. Softw. Eng.. Softw. Eng. 23, 501–532 (2016). https://doi.org/10.1007/s10515-014-0175-x
Alkharabsheh, K.; Alawadi, S.; Kebande, V.R.; Crespo, Y.; Fernández-Delgado, M.; Taboada, J.A.: A comparison of machine learning algorithms on design smell detection using balanced and imbalanced dataset: a study of God class. Inf. Softw. Technol.Softw. Technol. (2022). https://doi.org/10.1016/j.infsof.2021.106736
Alkharabsheh, K.; Alawadi, S.; Ignaim, K.; Zanoon, N.; Crespo, Y.; Manso, E.; Taboada, J.A.: Prioritization of god class design smell: A multi-criteria based approach. J. King Saud Univ. Comput. Inf. Sci. (2022). https://doi.org/10.1016/j.jksuci.2022.09.011
Anquetil, N.; Etien, A.; Andreo, G.; Ducasse, S.: Decomposing God Classes at Siemens. In: Proceedings - 2019 IEEE International Conference on Software Maintenance and Evolution, ICSME 2019. pp. 169–180. Institute of Electrical and Electronics Engineers Inc. (2019)
Palomba, F.; Bavota, G.; Penta, M.D.; Fasano, F.; Oliveto, R.; Lucia, A.D.: On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation. Empir. Softw. Eng.. Softw. Eng. 23, 1188–1221 (2018). https://doi.org/10.1007/s10664-017-9535-z
Moha, N.; Guéhéneuc, Y.G.; Duchien, L.; Le Meur, A.F.: DECOR: A method for the specification and detection of code and design smells. IEEE Trans. Softw. Eng.Softw. Eng. 36, 20–36 (2010). https://doi.org/10.1109/TSE.2009.50
Kaur, A.; Dhiman, G.: A Review on Search-Based Tools and Techniques to Identify Bad Code Smells in Object-Oriented Systems. In: Advances in Intelligent Systems and Computing. pp. 909–921. Springer Singapore (2019)
Malhotra, R.; Chug, A.; Khosla, P.: Prioritization of Classes for Refactoring. In: Proceedings of the Third International Symposium on Women in Computing and Informatics - WCI ’15. pp. 228–234. ACM Press, New York, New York, USA (2015)
Ge, X.; DuBose, Q.L.; Murphy-Hill, E.: Reconciling manual and automatic refactoring. In: Proceedings - International Conference on Software Engineering. pp. 211–221 (2012)
Lacerda, G.; Petrillo, F.; Pimenta, M.; Guéhéneuc, Y.G.: Code smells and refactoring: a tertiary systematic review of challenges and observations. J. Syst. Softw.Softw. (2020). https://doi.org/10.1016/j.jss.2020.110610
Mens, T.; Tourwé, T.: A survey of software refactoring. IEEE Trans. Softw. Eng.Softw. Eng. 30, 126–139 (2004). https://doi.org/10.1109/TSE.2004.1265817
Verma, R.; Kumar, K.; Verma, H.K.: A Study of Relevant Parameters Influencing Code Smell Prioritization in Object-Oriented Software Systems. Proceedings of IEEE International Conference on Signal Processing,Computing and Control. 2021-Octob, 150–154 (2021). https://doi.org/10.1109/ISPCC53510.2021.9609478
Verma, R.; Kumar, K.; Verma, H.K.: Code smell prioritization in object-oriented software systems: a systematic literature review. J. Softw. Evol. Process. (2023). https://doi.org/10.1002/smr.2536
Vaucher, S.; Khomh, F.; Moha, N.; Guéhéneuc, Y.G.: Tracking design smells: Lessons from a study of God classes. In: Proceedings - Working Conference on Reverse Engineering, WCRE. pp. 145–154 (2009)
Kovačević, A.; Slivka, J.; Vidaković, D.; Grujić, K.G.; Luburić, N.; Prokić, S.; Sladić, G.: Automatic detection of Long Method and God Class code smells through neural source code embeddings. Expert Syst. Appl. (2022). https://doi.org/10.1016/j.eswa.2022.117607
Fontana, F.A.; Ferme, V.; Marino, A.: Is it a Real Code Smell to be Removed or not? (2013)
Gupta, A.; Chauhan, N.K.: A severity-based classification assessment of code smells in Kotlin and java application. Arab. J. Sci. Eng. (2021). https://doi.org/10.1007/s13369-021-06077-6
Paiva, T.; Damasceno, A.; Figueiredo, E.; Sant’Anna, C.: On the evaluation of code smells and detection tools. J. Softw. Eng. Res. Dev. (2017). https://doi.org/10.1186/s40411-017-0041-1
Kaur, S.; Singh, P.: How does object-oriented code refactoring influence software quality? Research landscape and challenges. J. Syst. Softw.Softw. 157, 110394 (2019). https://doi.org/10.1016/j.jss.2019.110394
Lacerda, G.; Petrillo, F.; Pimenta, M.: Code smells and refactoring: a tertiary systematic review of challenges and observations. (2020)
Danphitsanuphan, P.; Suwantada, T.: Code smell detecting tool and code smell-structure bug relationship. In: 2012 Spring World Congress on Engineering and Technology, SCET 2012 - Proceedings (2012)
Yamashita, A.; Moonen, L.: Exploring the impact of inter-smell relations on software maintainability: an empirical study. Proc. Int. Conf. Softw. Eng. (2013). https://doi.org/10.1109/ICSE.2013.6606614
Yamashita, A.; Moonen, L.: To what extent can maintenance problems be predicted by code smell detection? An empirical study. Inf. Softw. Technol.Softw. Technol. 55, 2223–2242 (2013). https://doi.org/10.1016/j.infsof.2013.08.002
Liu, H.; Ma, Z.; Shao, W.; Niu, Z.: Schedule of bad smell detection and resolution: a new way to save effort. IEEE Trans. Software Eng. 38, 220–235 (2012). https://doi.org/10.1109/TSE.2011.9
Fontana, F.A.; Zanoni, M.: On investigating code smells correlations. In: Proceedings - 4th IEEE International Conference on Software Testing, Verification, and Validation Workshops, ICSTW 2011. pp. 474–475 (2011)
Fard, A.M.; Mesbah, A.: JSNOSE: Detecting javascript code smells. In: IEEE 13th International Working Conference on Source Code Analysis and Manipulation, SCAM 2013. pp. 116–125. IEEE Computer Society (2013)
Kiefer, C.; Bernstein, A.; Tappolet, J.: Mining software repositories with iSPARQL and a software evolution ontology. Proceedings - ICSE 2007 Workshops: Fourth International Workshop on Mining Software Repositories, MSR 2007. (2007). https://doi.org/10.1109/MSR.2007.21
Liu, X.; Zhang, C.: The detection of code smell on software development: a mapping study. In: Proceedings of the 2017 5th International Conference on Machinery, Materials and Computing Technology (ICMMCT 2017). pp. 560–575. Atlantis Press, Paris, France (2017)
Fontana, F.A.; Ferme, V.; Marino, A.: Is it a Real Code Smell to be Removed or not? Inter-smell relationships View project PONTRAGA View project Is it a Real Code Smell to be Removed or not?
Fontana, F.A.; Ferme, V.; Zanoni, M.; Roveda, R.: Towards a prioritization of code debt: A code smell Intensity Index. In: 2015 IEEE 7th International Workshop on Managing Technical Debt (MTD). pp. 16–24. IEEE (2015)
Amrita, G.P.; Singh, P.: Priority-wise test case allocation using fuzzy logic. Int. J. Syst. Assurance Eng. Manag. (2021). https://doi.org/10.1007/s13198-021-01247-z
Pecorelli, F.; Palomba, F.; Khomh, F.; De Lucia, A.: Developer-Driven Code Smell Prioritization. In: Proceedings of the 17th International Conference on Mining Software Repositories. pp. 220–231. ACM, New York, NY, USA (2020)
Fontana, F.A.; Mariani, E.; Morniroli, A.; Sormani, R.; Tonello, A.: An experience report on using code smells detection tools. In: Proceedings - 4th IEEE International Conference on Software Testing, Verification, and Validation Workshops, ICSTW 2011. 450–457 (2011). https://doi.org/10.1109/ICSTW.2011.12
Arcoverde, R.; Guimaraes, E.; Macia, I.; Garcia, A.; Cai, Y.: Prioritization of Code Anomalies Based on Architecture Sensitiveness. In: 2013 27th Brazilian Symposium on Software Engineering. pp. 69–78. IEEE (2013)
Oliveira, A.; Sousa, L.; Oizumi, W.; Garcia, A.: On the Prioritization of Design-Relevant Smelly Elements. In: Proceedings of the XIII Brazilian Symposium on Software Components, Architectures, and Reuse - SBCARS ’19. pp. 83–92. ACM Press, New York, New York, USA (2019)
BafandehMayvan, B.; Rasoolzadegan, A.; JavanJafari, A.: Bad smell detection using quality metrics and refactoring opportunities. J. Softw. Evol. Process. (2020). https://doi.org/10.1002/smr.2255
Shahidi, M.; Ashtiani, M.; Zakeri-Nasrabadi, M.: An automated extract method refactoring approach to correct the long method code smell. J. Syst. Softw.Softw. (2022). https://doi.org/10.1016/j.jss.2022.111221
Habchi, S.; Moha, N.; Rouvoy, R.: Android code smells: From introduction to refactoring. J. Syst. Softw.Softw. (2021). https://doi.org/10.1016/j.jss.2021.110964
Danphitsanuphan, P.: Code Smell Detecting Tool and Code Smell-Structure Bug Relationship Code Smell Detecting Tool and Code Smell-Structure Bug Relationship. (2014). https://doi.org/10.1109/SCET.2012.6342082
Funding
No funding was obtained for this study.
Author information
Authors and Affiliations
Contributions
Conceptualization: Renu Verma, Kuldeep Kumar; Data Curation: Renu Verma, Kuldeep Kumar; Methodology: Renu Verma, Kuldeep Kumar, Harsh K. Verma, Formal analysis and investigation: Renu Verma, Kuldeep Kumar, Harsh K. Verma; Writing—original draft preparation: Renu Verma, Kuldeep Kumar; Writing—review and editing: Harsh K. Verma.
Corresponding author
Ethics declarations
Conflict of interest
The authors declare that they have no conflict/competing of interest.
Electronic supplementary material
Below is the link to the electronic supplementary material.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Verma, R., Kumar, K. & Verma, H.K. Prioritizing God Class Code Smells in Object-Oriented Software Using Fuzzy Inference System. Arab J Sci Eng (2024). https://doi.org/10.1007/s13369-024-08826-9
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s13369-024-08826-9