journal article·2024-07-15Open access

Machine Learning-Based Methods for Code Smell Detection: A Survey

Pravin Singh Yadav, Rajwant Singh Rao, Alok Mishra, Manjari Gupta

Applied Sciences· Volume 14· Issue 14

Abstract

Code smells are early warning signs of potential issues in software quality. Various techniques are used in code smell detection, including the Bayesian approach, rule-based automatic antipattern detection, antipattern identification utilizing B-splines, Support Vector Machine direct, SMURF (Support Vector Machines for design smell detection using relevant feedback), and immune-based detection strategy. Machine learning (ML) has taken a great stride in this area. This study includes relevant studies applying ML algorithms from 2005 to 2024 in a comprehensive manner for the survey to provide insight regarding code smell, ML algorithms frequently applied, and software metrics. Forty-two pertinent studies allow us to assess the efficacy of ML algorithms on selected datasets. After evaluating various studies based on open-source and project datasets, this study evaluated additional threats and obstacles to code smell detection, such as the lack of standardized code smell definitions, the difficulty of feature selection, and the challenges of handling large-scale datasets. The current studies only considered a few factors in identifying code smells, while in this study, several potential contributing factors to code smells are included. Several ML algorithms are examined, and various approaches, datasets, dataset languages, and software metrics are presented. This study provides the potential of ML algorithms to produce better results and fills a gap in the body of knowledge by providing class-wise distributions of the ML algorithms. Support Vector Machine, J48, Naive Bayes, and Random Forest models are the most common for detecting code smells. Researchers can find this study helpful in better anticipating and taking care of software development design and implementation issues. The findings from this study, which highlight the practical implications of ML algorithms in software quality improvement, will help software engineers fix problems during software design and development to ensure software quality.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Software Engineering Research · Software Reliability and Analysis Research · Advanced Malware Detection Techniques

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Computer Science and Information Technology, Guru Ghasidas Vishwavidyalaya, Bilaspur 495009, Chhattisgarh, India

Faculty of Engineering, Norwegian University of Science and Technology (NTNU), 7491 Trondheim, Norway

Informatics and Digitalization Group, Molde University College, Specialized University in Logistics, 6402 Molde, Norway

Computer Science, DST—Centre for Interdisciplinary Mathematical Sciences, Institute of Science, Banaras Hindu University, Varanasi 221005, Uttar Pradesh, India

References (66)

Show source-provided references
1. Dewangan, S., Rao, R.S., and Yadav, P.S. (2022, January 21–23). Dimensionally Reduction based Machine Learning Approaches for Code smells Detection. Proceedings of the 2022 International Conference on Intelligent Controller and Computing for Smart Power (ICICCSP), Hyderabad, India.10.1109/ICICCSP53532.2022.9862030 ↗
2. Yadav, P.S., Dewangan, S., and Rao, R.S. (2021, January 1–2). Extraction of Prediction Rules of Code Smell using Decision Tree Algorithm. Proceedings of the International Conference on Internet of Everything, Microwave Engineering, Communication and Networks (IEMECON), Jaipur, India.10.1109/IEMECON53809.2021.9689174 ↗
3. Predicting Code Smells and Analysis of Predictions: Using Machine Learning Techniques and Software Metrics10.1007/s11390-020-0323-7 ↗
4. Method-Level Code Smells Detection Using Machine Learning Models10.1007/978-981-99-3734-9_7 ↗
5. Feature reduction techniques based code smell prediction
6. Code Smell Detection Using Classification Approaches10.1007/978-981-19-0901-6_25 ↗
7. Di Nucci, D., Palomba, F., Tamburri, D.A., Serebrenik, A., and De Lucia, A. (2018, January 20–23). Detecting code smells using machine learning techniques: Are we there yet?. Proceedings of the International Conference on Software Analysis, Evolution and Reengineering (SANER), Campobasso, Italy.10.1109/SANER.2018.8330266 ↗
8. Detection of Shotgun Surgery and Message Chain Code Smells using Machine Learning Techniques10.4018/IJRSDA.2019040103 ↗
9. A Feature Selection based Ensemble Classification Framework for Software Defect Prediction10.5815/ijmecs.2019.09.06 ↗
10. Pecorelli, F., Palomba, F., Di Nucci, D., and De Lucia, A. (2019, January 25–26). Comparing heuristic and machine learning approaches for metric-based code smell detection. Proceedings of the International Conference on Program Comprehension, Montreal, QC, Canada.10.1109/ICPC.2019.00023 ↗
11. Machine Learning Techniques for Code Smells Detection: A Systematic Mapping Study10.1142/S021819401950013X ↗
12. A review on search-based tools and techniques to identify bad code smells in object-oriented systems10.1007/978-981-13-0761-4_86 ↗
13. Machine learning techniques for code smell detection: A systematic literature review and meta-analysis10.1016/j.infsof.2018.12.009 ↗
14. A Review on Machine-learning Based Code Smell Detection Techniques in Object-oriented Software System(s)
15. Code Smells Detection and Visualization: A Systematic Literature Review10.1007/s11831-021-09566-x ↗
16. Bad Smell Detection Using Machine Learning Techniques: A Systematic Literature Review10.1007/s13369-019-04311-w ↗
17. A systematic literature review: Refactoring for disclosing code smells in object oriented software10.1016/j.asej.2017.03.002 ↗
18. A Systematic Literature Review on Bad Smells-5 W’s: Which, When, What, Who, Where10.1109/TSE.2018.2880977 ↗
19. Code Bad Smells: A review of current knowledge10.1002/smr.521 ↗
20. A review of code smell mining techniques10.1002/smr.1737 ↗
21. Fernandes, E., Oliveira, J., Vale, G., Paiva, T., and Figueiredo, E. (2016, January 1–3). A Review-based Comparative Study of Bad Smell Detection Tools. Proceedings of the EASE ‘16: 20th International Conference on Evaluation and Assessment in Software Engineering, Limerick, Ireland.10.1145/2915970.2915984 ↗
22. A systematic literature review: Code bad smells in java source code10.1007/978-3-319-62404-4_49 ↗
23. A survey on software smells10.1016/j.jss.2017.12.034 ↗
24. Haque, M.S., Carver, J., and Atkison, T. (2018, January 29–31). Causes, impacts, and detection approaches of code smell: A survey. Proceedings of the ACMSE 2018 Conference, Richmond, KY, USA.10.1145/3190645.3190697 ↗
25. Code smell detection based on supervised learning models: A survey10.1016/j.neucom.2023.127014 ↗
26. Comparing and experimenting machine learning techniques for code smell detection10.1007/s10664-015-9378-4 ↗
27. Kaur, A., Jain, S., and Goel, S. (2017, January 14–15). A Support Vector Machine Based Approach for Code Smell Detection. Proceedings of the International Conference on Machine Learning and Data Science, Noida, India.10.1109/MLDS.2017.8 ↗
28. Nizam, A., Avar, M.Y., Adaş, Ö.K., and Yanık, A. (2023, January 11–13). Detecting Code Smell with a Deep Learning System. Proceedings of the Innovations in Intelligent Systems and Applications Conference, Sivas, Turkiye.10.1109/ASYU58738.2023.10296577 ↗
29. Shah, R.N., Mohamed, S.A., Imran, A., and Kosar, T. (2023, January 4–6). CloudScent: A Model for Code Smell Analysis in Open-Source Cloud. Proceedings of the IEEE International Conference on Cloud Computing Technology and Science (CloudCom), Naples, Italy.10.1109/CloudCom59040.2023.00024 ↗
30. Code Smell Detection Using Whale Optimization Algorithm
31. Kitchenham, B., and Charters, S. (2007). Guidelines for Performing Systematic Literature Reviews in Software Engineering, Keele University.
32. Adaptive Detection of Design Flaws10.1016/j.entcs.2005.02.059 ↗
33. Khomh, F., Vaucher, S., Guéehéeneuc, Y.G., and Sahraoui, H. (2009, January 24–25). A bayesian approach for the detection of code and design smells. Proceedings of the International Conference on Quality Software, Jeju, Republic of Korea.10.1109/QSIC.2009.47 ↗
34. Vaucher, S., Khomh, F., Moha, N., and Guéhéneuc, Y.G. (2009, January 13–16). Tracking design smells: Lessons from a study of God classes. Proceedings of the Working Conference on Reverse Engineering, Lille, France.10.1109/WCRE.2009.23 ↗
35. Oliveto, R., Khomh, F., Antoniol, G., and Guéhéneuc, Y.G. (2010, January 15–18). Numerical signatures of antipatterns: An approach based on B-Splines. Proceedings of the European Conference on Software Maintenance and Reengineering, Madrid, Spain.10.1109/CSMR.2010.47 ↗
36. Hassaine, S., Khomh, F., Guéhéneucy, Y.G., and Hamel, S. (October, January 29). IDS: An immune-inspired approach for the detection of software design smells. Proceedings of the 2010 Seventh International Conference on the Quality of Information and Communications Technology, Porto, Portugal.10.1109/QUATIC.2010.61 ↗
37. Bryton, S., Abreu, F.B.E., and Monteiro, M. (October, January 29). Reducing subjectivity in code smells detection: Experimenting with the Long Method. Proceedings of the 2010 Seventh International Conference on the Quality of Information and Communications Technology, Porto, Portugal.10.1109/QUATIC.2010.60 ↗
38. Maneerat, N., and Muenchaisri, P. (2011, January 11–13). Bad-smell prediction from software design model using machine learning techniques. Proceedings of the International Joint Conference on Computer Science and Software Engineering, Nakhonpathom, Thailand.10.1109/JCSSE.2011.5930143 ↗
39. BDTEX: A GQM-based Bayesian approach for the detection of antipatterns10.1016/j.jss.2010.11.921 ↗
40. Danphitsanuphan, P., and Suwantada, T. (2012, January 27–30). Code smell detecting tool and code smell-structure bug relationship. Proceedings of the Spring World Congress on Engineering and Technology, Xi’an, China.10.1109/SCET.2012.6342082 ↗
41. Wang, X., Dang, Y., Zhang, L., Zhang, D., Lan, E., and Mei, H. (2012, January 3–7). Can I clone this piece of code here?. Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, Essen, Germany.10.1145/2351676.2351701 ↗
42. Maiga, A., Ali, N., Bhattacharya, N., Sabané, A., Guéhéneuc, Y.G., Antoniol, G., and Aimeur, E. (2012, January 3–7). Support vector machines for anti-pattern detection. Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, Essen, Germany.10.1145/2351676.2351723 ↗
43. Maiga, A., Ali, N., Bhattacharya, N., Sabané, A., Guéhéneuc, Y.G., and Aimeur, E. (2012, January 15–18). SMURF: A SVM-based incremental anti-pattern detection approach. Proceedings of the Working Conference on Reverse Engineering, Kingston, ON, Canada.10.1109/WCRE.2012.56 ↗
44. Palomba, F., Bavota, G., Di Penta, M., Oliveto, R., De Lucia, A., and Poshyvanyk, D. (2013, January 11–15). Detecting bad smells in source code using change history information. Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, Silicon Valley, CA, USA.10.1109/ASE.2013.6693086 ↗
45. Mining version histories for detecting code smells10.1109/TSE.2014.2372760 ↗
46. Fontana, F.A., Zanoni, M., Marino, A., and Mäntylä, M.V. (2013, January 22–28). Code smell detection: Towards a machine learning-based approach. Proceedings of the IEEE International Conference on Software Maintenance, Eindhoven, The Netherlands.10.1109/ICSM.2013.56 ↗
47. Fu, S., and Shen, B. (2015, January 22–23). Code Bad Smell Detection through Evolutionary Data Mining. Proceedings of the International Symposium on Empirical Software Engineering and Measurement, Beijing, China.10.1109/ESEM.2015.7321194 ↗
48. Amorim, L., Costa, E., Antunes, N., Fonseca, B., and Ribeiro, M. (2015, January 2–5). Experience report: Evaluating the effectiveness of decision trees for detecting code smells. Proceedings of the International Symposium on Software Reliability Engineering, Gaithersbury, MD, USA.10.1109/ISSRE.2015.7381819 ↗
49. Classification model for code clones based on machine learning10.1007/s10664-014-9316-x ↗
50. Palomba, F., Panichella, A., De Lucia, A., Oliveto, R., and Zaidman, A. (2016, January 16–17). A textual-based technique for Smell Detection. Proceedings of the IEEE International Conference on Program Comprehension, Austin, TX, USA.10.1109/ICPC.2016.7503704 ↗
51. White, M., Tufano, M., Vendome, C., and Poshyvanyk, D. (2016, January 3–7). Deep learning code fragments for code clone detection. Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (ASE), Singapore.10.1145/2970276.2970326 ↗
52. Aras, M.T., and Selcuk, Y.E. (2016, January 13–14). Metric and rule based automated detection of antipatterns in object-oriented software systems. Proceedings of the International Conference on Computer Science and Information Technology, Amman, Jordan.10.1109/CSIT.2016.7549470 ↗
53. Tarwani, S., and Chug, A. (2016, January 7–9). Predicting maintainability of open source software using Gene Expression Programming and bad smells. Proceedings of the International Conference on Reliability, Infocom Technologies and Optimization (ICRITO), Noida, India.10.1109/ICRITO.2016.7784998 ↗
54. Hozano, M., Antunes, N., Fonseca, B., and Costa, E. (2017, January 26–29). Evaluating the accuracy of machine learning algorithms on detecting code smells for different developers. Proceedings of the International Conference on Enterprise Information Systems, Porto, Portugal.10.5220/0006338804740482 ↗
55. Code smell severity classification using machine learning techniques10.1016/j.knosys.2017.04.014 ↗
56. Finding Bad Code Smells with Neural Network Models10.11591/ijece.v7i6.pp3613-3621 ↗
57. Evaluation of machine learning approaches for change-proneness prediction using code smells10.1007/978-981-10-3153-3_56 ↗
58. Jesudoss, A., Maneesha, S., and Durga, T.L.N. (2019, January 15–17). Identification of code smell using machine learning. Proceedings of the International Conference on Intelligent Computing and Control Systems, Madurai, India.10.1109/ICCS45141.2019.9065317 ↗
59. Generating Code-Smell Prediction Rules Using Decision Tree Algorithm and Software Metrics
60. Gupta, H., Kumar, L., and Neti, L.B.M. (2019, January 13–15). An empirical framework for code smell prediction using extreme learning machine. Proceedings of the Annual Information Technology, Electromechanical Engineering and Microelectronics Conference, Jaipur, India.10.1109/IEMECONX.2019.8877082 ↗
61. Kiyak, E.O., Birant, D., and Birant, K.U. (2019, January 11–13). Comparison of Multi-Label Classification Algorithms for Code Smell Detection. Proceedings of the International Symposium on Multidisciplinary Studies and Innovative Technologies (ISMSIT), Ankara, Turkey.10.1109/ISMSIT.2019.8932855 ↗
62. Code smell detection using multi-label classification approach10.1007/s11219-020-09498-y ↗
63. A Novel Four-Way Approach Designed with Ensemble Feature Selection for Code Smell Detection10.1109/ACCESS.2021.3049823 ↗
64. An Empirical Study on Predictability of Software Code Smell Using Deep Learning Models10.1007/978-3-030-75075-6_10 ↗
65. A novel approach for code smell detection: An empirical study10.1109/ACCESS.2021.3133810 ↗
66. Crowdsmelling: A preliminary study on using collective knowledge in code smells detection10.1007/s10664-021-10110-5 ↗