Code smells are software flaws that make it challenging to comprehend, develop, and maintain the software. Identifying and removing code smells is crucial for software quality. This study examines the effectiveness of several machine-learning models before and after applying feature selection and data balancing on code smell datasets. Extreme Gradient Boosting, Gradient Boosting, Adaptive Boosting, Random Forest, Artificial Neural Network (ANN), and Ensemble model of Bagging, and the two best-performing Boosting techniques are used to predict code smell. This study proposes an enhanced approach, which is an ensemble model of the Bagging and Boosting classifier (EMBBC) that incorporates feature selection and data balancing techniques to predict code smells. Four publicly available code smell datasets, Blob Class, Data Class, Long Parameter List, and Switch Statement, were considered for the experimental work. Classes of datasets are balanced using the Synthetic Minority Over-Sampling Technique (SMOTE). A feature selection method called Recursive Feature Elimination with Cross-Validation (RFECV) is used. This study shows that the ensemble model of Bagging and the two best-performing Boosting techniques performs better in Blob Class, Data Class, and Long Parameter List datasets with the highest accuracy of 99.21%, 99.21%, and 97.62%, respectively. In the Switch Statement dataset, the ANN model provides a higher accuracy of 92.86%. Since the proposed model uses only seven features and still provides better results than others, it could be helpful to detect code smells for software engineers and practitioners in less computational time, improving the system's overall performance.
Read full abstract