Abstract
Code smell detection is critical for calculating system quality and identifying issues that require more work and development. The technique of finding wrongly developed code components and implementing them is known as code smell detection. In this study, we used two method-level code smell datasets: the long parameter list and the switch statement, for detecting the code smells. A SMOTE class balancing approach is utilized to deal with the issue of class imbalance in datasets. A wrapper-based feature selection approach is used to choose the best features from each dataset. We applied three ensemble learning-based machine learning methods. To validate the model's accuracy, we utilized a fivefold cross-validation technique with five performance measurements (precision, recall, F-measure, AUC_Score, and accuracy). Using the max voting dataset, we obtained the best accuracy of 97.12% for the long parameter list dataset.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Booch G (1980) Object-oriented analysis and design. Addison-Wesley
Fowler M, Beck K, Brant J, Opdyke W, Roberts D (1999) Refactoring: improving the design of existing programs
Bavota G, Lucia AD, Penta MD, Oliveto R, Palomba F (2015) An experimental investigation on the innate relationship between quality and refactoring. J Syst Softw 107:1–14. https://doi.org/10.1016/j.jss.2015.05.024
Charalampidou S, Ampatzoglou A, Avgeriou P (2015) Size and cohesion metrics as indicators of the long method bad smell: an empirical study. In: Proceedings of the 11th International conference on predictive models and data analytics in software engineering, PROMISE ’15. Association for Computing Machinery, Beijing, China, pp 1–10. https://doi.org/10.1145/2810146.2810155
Moha N, Gueheneuc Y-G, Duchien L, Le Meur A-F (2010) DECOR: a method for the specification and detection of code and design smells. IEEE Trans Softw Eng 36(1):20–36. https://doi.org/10.1109/TSE.2009.50
Alkharabsheh K, Crespo Y, Manso E, Taboada JA (2019) Software design smell detection: a systematic mapping study. Softw Qual J 27(3):1069–1148. https://doi.org/10.1007/s11219-018-9424-8
Wiegers K, Beatty J (2013) Software requirements. Pearson Education, London, UK
Chung L, do PLJCS (2009) On non-functional requirements in software engineering. In: Borgida AT, Chaudhri V, Giorgini P, YuE ES (eds) Conceptual modeling: foundations and applications. Lecture Notes in Computer Science. Springer, Cham, Switzerland, pp 363–379
Fontana FA, Mäntylä MV, Zanoni M, Marino A (2016) Comparing and experimenting machine learning techniques for code smell detection. Empirical Softw Eng 21(3):1143–1191
Alazba A, Aljamaan HI (2021) Code smell detection using feature selection and stacking ensemble: an empirical investigation. Inf Softw Technol 138:106648
Dewangan S, Rao RS, Mishra A, Gupta M (2021) A novel approach for code smell detection: an empirical study. IEEE Access 9:162869–162883. https://doi.org/10.1109/ACCESS.2021.3133810
Mhawish MY, Gupta M (2019) Generating code-smell prediction rules using decision tree algorithm and software metrics. Int J Comput Sci Eng (IJCSE) 7(5):41–48
Mhawish MY, Gupta M (2020) Predicting code smells and analysis of predictions: using machine learning techniques and software metrics. J Comput Sci Technol 35(6):1428–1445. https://doi.org/10.1007/s11390-020-0323-7
Yadav PS, Dewangan S, Rao RS (2021) Extraction of prediction rules of code smell using decision tree algorithm. In: 2021 10th International conference on internet of everything, microwave engineering, communication and networks (IEMECON), pp. 1–5. https://doi.org/10.1109/IEMECON53809.2021.9689174
Dewangan S, Rao RS (2022) Code smell detection using classification approaches. In: Udgata SK, Sethi S, Gao XZ (eds) Intelligent systems. Lecture notes in networks and systems, vol 431. Springer, Singapore. https://doi.org/10.1007/978-981-19-0901-6_25
Dewangan S, Rao RS, Yadav PS (2022) Dimensionally reduction based machine learning approaches for code smells detection. In: 2022 International conference on intelligent controller and computing for smart power (ICICCSP), pp 1–4. https://doi.org/10.1109/ICICCSP53532.2022.9862030
Dewangan S, Rao RS, Mishra A, Gupta M (2022) Code smell detection using ensemble machine learning algorithms. Appl Sci 12(20):10321. https://doi.org/10.3390/app122010321
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
Cite this paper
Dewangan, S., Rao, R.S. (2023). Method-Level Code Smells Detection Using Machine Learning Models. In: Das, A.K., Nayak, J., Naik, B., Vimal, S., Pelusi, D. (eds) Computational Intelligence in Pattern Recognition. CIPR 2022. Lecture Notes in Networks and Systems, vol 725. Springer, Singapore. https://doi.org/10.1007/978-981-99-3734-9_7
Download citation
DOI: https://doi.org/10.1007/978-981-99-3734-9_7
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-99-3733-2
Online ISBN: 978-981-99-3734-9
eBook Packages: Intelligent Technologies and RoboticsIntelligent Technologies and Robotics (R0)