Code Smell Detection Using Ensemble Machine Learning Algorithms
Source abstract
Abstract
Code smells are the result of not following software engineering principles during software development, especially in the design and coding phase. It leads to low maintainability. To evaluate the quality of software and its maintainability, code smell detection can be helpful. Many machine learning algorithms are being used to detect code smells. In this study, we applied five ensemble machine learning and two deep learning algorithms to detect code smells. Four code smell datasets were analyzed: the Data class, the God class, the Feature-envy, and the Long-method datasets. In previous works, machine learning and stacking ensemble learning algorithms were applied to this dataset and the results found were acceptable, but there is scope of improvement. A class balancing technique (SMOTE) was applied to handle the class imbalance problem in the datasets. The Chi-square feature extraction technique was applied to select the more relevant features in each dataset. All five algorithms obtained the highest accuracy—100% for the Long-method dataset with the different selected sets of metrics, and the poorest accuracy, 91.45%, was achieved by the Max voting method for the Feature-envy dataset for the selected twelve sets of metrics.
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, India
Informatics and Digitalization Group, Faculty of Logistics, Molde University College—Specialized University in Logistics, 6410 Molde, Norway
Computer Science, DST—Centre for Interdisciplinary Mathematical Sciences, Institute of Science, Banaras Hindu University, Varanasi 221005, India
References (57)
Show source-provided references
1. Mining Version Histories for Detecting Code Smells10.1109/TSE.2014.2372760 ↗
2. Wikipedia Contributors (2021, November 16). Code Smell. 20 October 2021. Available online: https://en.wikipedia.org/w/index.php?title=Code_smell&oldid=1050826229.
3. A cooperative parallel search-based software engineering approach for code-smells detection10.1109/TSE.2014.2331057 ↗
4. Automatic detection of bad smells in code: An experimental assessment
5. Udgata, S.K., Sethi, S., and Gao, X.Z. (2022). Code Smell Detection Using Classification Approaches. Intelligent Systems, Springer. Lecture Notes in Networks and Systems.10.1007/978-981-19-0901-6 ↗
6. A review of code smell mining techniques10.1002/smr.1737 ↗
7. Comparing and experimenting machine learning techniques for code smell detection10.1007/s10664-015-9378-4 ↗
8. Programs, life cycles, and laws of software evolution10.1109/PROC.1980.11805 ↗
9. Wiegers, K. (2013). , Beatty, J. Software Requirements, Pearson Education.
10. Borgida, A.T., Chaudhri, V., Giorgini, P., and Yu, E. (2009). On Non-Functional Requirements in Software Engineering. Conceptual Modeling: Foundations and Applications-Essays in Honor of John Mylopoulos, Springer.10.1007/978-3-642-02463-4 ↗
11. Fowler, M., Beck, K., Brant, J., Opdyke, W., and Roberts, D. (1999). Refactoring: Improving the Design of Existing Code, Addison-Wesley Professional. [1st ed.].
12. Yamashita, A., and Moonen, L. (2012, January 23). Do Code Smells Reflect Important Maintainability aspects?. Proceedings of the 28th IEEE International Conference Software Maintenance, Trento, Italy.10.1109/ICSM.2012.6405287 ↗
13. Quantifying the effect of code smells on maintenance effort10.1109/TSE.2012.89 ↗
14. Code-smells detection as a bi-level problem10.1145/2675067 ↗
15. Olbrich, S.M., Cruzes, D.S., and Sjoøberg, D.I.K. (2010, January 12–18). Are all Code Smells Harmful? A study of God Classes and Brain Classes in the evolution of Three open-Source Systems. Proceedings of the 26th IEEE International Conference Software Maintenance, Timisoara, Romania.10.1109/ICSM.2010.5609564 ↗
16. Khomh, F., Penta, D.M., and Gueheneuc, Y.G. (2009, January 13–16). An Exploratory Study of the Impact of Code Smells on Software Change Proneness. Proceedings of the 16th Working Conference on Reverse Engineering, Lille, France.10.1109/WCRE.2009.28 ↗
17. A controlled experiment investigation of an object-oriented design heuristic for maintainability10.1016/S0164-1212(03)00240-1 ↗
18. An empirical study of the bad smells and class error probability in the post-release object-oriented system evolution10.1016/j.jss.2006.10.018 ↗
19. Analyzing the harmful effect of god class refactoring on power consumption10.1109/MS.2014.23 ↗
20. Code smell detection using multi-label classification approach10.1007/s11219-020-09498-y ↗
21. How far are we from reproducible research on code smell detection? A systematic literature review10.1016/j.infsof.2021.106783 ↗
22. Code smell detection using feature selection and stacking ensemble: An empirical investigation10.1016/j.infsof.2021.106648 ↗
23. A Novel Approach for Code Smell Detection: An Empirical Study10.1109/ACCESS.2021.3133810 ↗
24. Code smell detection by deep direct-learning and transfer-learning10.1016/j.jss.2021.110936 ↗
25. Predicting code smells and analysis of predictions: Using machine learning techniques and software metrics10.1007/s11390-020-0323-7 ↗
26. Generating Code-Smell Prediction Rules Using Decision Tree Algorithm and Software Metrics
27. Satapathy, S., Bhateja, V., and Das, S. (2019). Predicting the Severity of Closed Source Bug Reports Using Ensemble Methods. Smart Intelligent Computing and Applications. Smart Innovation, Systems and Technologies, Springer.10.1007/978-981-13-1927-3 ↗
28. An Empirical Study towards dealing with Noise and Class Imbalance issues in Software Defect Prediction10.1007/s00500-021-06096-3 ↗
29. Code smell detection and identification in imbalanced environments10.1016/j.eswa.2020.114076 ↗
30. Code smell severity classification using machine learning techniques10.1016/j.knosys.2017.04.014 ↗
31. Machine Learning Approaches for Predicting the Severity Level of Software Bug Reports in Closed Source Projects
32. Predicting the severity of open source bug reports using unsupervised and supervised techniques10.4018/IJOSSP.2019010101 ↗
33. A Novel Four-Way Approach Designed with Ensemble Feature Selection for Code Smell Detection10.1109/ACCESS.2021.3049823 ↗
34. Code smell detection using whale optimization algorithm
35. Gupta, H., Kulkarni, T.G., Kumar, L., Neti, L.B.M., and Krishna, A. (2021). An Empirical Study on Predictability of Software Code Smell Using Deep Learning Models, Springer.10.1007/978-3-030-75075-6_10 ↗
36. Di Nucci, D., Palomba, F., Tamburri, D.A., Serebrenik, A., and de Lucia, A. Detecting Code Smells using Machine Learning Techniques: Are We There Yet? In Proceedings of the 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER), Campobasso, Italy, 20–23 March 2018.10.1109/SANER.2018.8330266 ↗
37. 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 2021 10th International Conference on Internet of Everything, Microwave Engineering, Communication and Networks (IEMECON), Jaipur, India.10.1109/IEMECON53809.2021.9689174 ↗
38. 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 2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC), Montreal, QC, Canada.10.1109/ICPC.2019.00023 ↗
39. Software Design Smell Detection: A systematic mapping study10.1007/s11219-018-9424-8 ↗
40. Exploratory study of the impact of project domain and size category on the detection of the God class design smell10.1007/s11219-021-09550-5 ↗
41. Multi-objective code-smells detection using good and bad design examples10.1007/s11219-016-9309-7 ↗
42. Tempero, E., Anslow, C., Dietrich, J., Han, T., Li, J., Lumpe, M., Melton, H., and Noble, J. (December, January 30). The Qualitas Corpus: A Curated Collection of Java Code for Empirical Studies. Proceedings of the 17th Asia Pacific Software Engenering Conference, Sydney, Australia.
43. Marinescu, C., Marinescu, R., Mihancea, P., Ratiu, D., and Wettel, R. (2005, January 29). iPlasma: An Integrated Platform for Quality Assessment of Object-Oriented Design. Proceedings of the 21st IEEE International Conference on Software Maintenance (ICSM 2005), Budapest, Hungary.
44. Nongpong, K. (2012). Integrating “Code Smells” Detection with Refactoring Tool Support. [Ph.D. Thesis, University of Wisconsin Milwaukee].
45. Marinescu, R. (2002). Measurement and Quality in Object-Oriented Design. [Ph.D. Thesis, Department of Computer Science, “Polytechnic” University of Timisoara].
46. Data Normalization and Standardization: A Technical Report
47. (2021, November 26). Boosting in Machine Learning | Boosting and AdaBoost. Available online: https://www.geeksforgeeks.org/boosting-in-machine-learning-boosting-and-adaboost/.
48. (2021, November 26). Bagging in Machine Learning: Step to Perform and Its Advantages. Available online: https://www.simplilearn.com/tutorials/machine-learning-tutorial/bagging-in-machine-learning#what_is_bagging_in_machine_learning.
49. (2021, November 26). ML | Voting Classifier using Sklearn. Available online: https://www.geeksforgeeks.org/ml-voting-classifier-using-sklearn/.
50. (2021, November 26). How the Gradient Boosting Algorithm Works?. Available online: https://www.analyticsvidhya.com/blog/2021/04/how-the-gradient-boosting-algorithm-works/.
51. Introduction to artificial neural networks10.1097/MEG.0b013e3282f198a0 ↗
52. upGrad (2022, September 04). Neural Network: Architecture, Components & Top Algorithms. Available online: https://www.upgrad.com/blog/neural-network-architecture-components-algorithms/.
53. Review of deep learning: Concepts, CNN architectures, challenges, applications, future directions10.1186/s40537-021-00444-8 ↗
54. (2022, September 04). K-Fold Cross-Validation. Available online: http://karlrosaen.com/ml/learning-log/2016-06-20/.
55. (2022, September 04). Machine Learning with Python. Available online: https://www.tutorialspoint.com/machine_learning_with_python/machine_learning_algorithms_performance_metrics.html.
56. (2022, September 04). Phi Coefficient. Available online: https://en.wikipedia.org/wiki/Phi_coefficient.
57. (2022, September 04). Cohen’s Kappa. Available online: https://en.wikipedia.org/wiki/Cohen%27s_kappa.