An Anti-Pattern Detection Technique Using Machine Learning to Improve Code Quality
Nazneen Akhter, Shanto Rahman, Kazi Abu Taher
Abstract
Poor software design and coding tend the software programs to be buggy at a massive rate. To enhance the code quality this paper proposes an automatic anti-pattern detection technique, which identifies anti-patterns from source code using Machine Learning (ML) classifiers. Here, four anti-patterns are considered such as Blob, Feature Decomposition (FD), Swiss Army Knife (SAK) and Spaghetti Code (SC) from three open-source Java projects namely ArgoUML, Azureus and Xerces. To improve the accuracy, a data pre-processing technique namely SMOTE is adopted. To locate these anti-patterns, four ML classifiers have been used which are Support Vector Machine (SVM), Naive Bayes (NB), Random Forest (RF) and Decision Tree (DT). The proposed technique shows a better performance in terms of three evaluation metrics such as precision, recall, f-measure. SVM with SMOTE performs better in terms of precision and recall that are respectively 96.42% and 96.18%.