Tracing Bad Code Smells Behavior Using Machine Learning with Software Metrics
Aakanshi Gupta, Bharti Suri, Lakshay Lamba · 2021
The inappropriate symptoms in the code design pattern which are developed by the developers at the software development phase are termed as bad code smells. Bad code smells concur to deep rooted and serious issues in the software during maintenance phase. Using a various combination of object-oriented metrics; bad smell detection tools and techniques provide different results in many ways. In this study, four different machine learning algorithms namely J48, JRip, Random Forest and Naive Bayes, have been considered to detect three types of bad smells God Class, Long Method and Feature Envy. The prime attribute to extract the bad smells features is software metrics. These metrics names are: Lines of Code, Depth of Inheritance, Coupling between objects and many others that have been put to identify the quality of code at different levels. The results demonstrated that the machine learning algorithms achieved high accuracy with the validation method of 10-fold cross-validation. The bad smell detection through machine learning can come up with efficiency up to 90% and more in a few test cases.