65
Views
3
CrossRef citations to date
0
Altmetric
Articles

Application of machine learning algorithms for code smell prediction using object-oriented software metrics

&
 

Abstract

Code smells are generally not considered as bugs; instead, they point out certain shortcomings in the software design or code. Identification of code smell is a necessary step for improving the software quality and reducing the maintenance effort. In this study, we introduce a bad smell prediction technique based on object-oriented software metrics that use Decision Tree (DT) and Random Forest (RF) machine learning algorithm. An open-source project, namely JHOTDRAW, was used as our dataset, for which values of object-oriented software metrics were calculated. Two feature selection methods-Random Forest Importance (RFI) and Information Gain (IG) were applied to extract the most relevant attributes for the prediction of code smells, namely, Feature envy, Dispersed coupling, refused parent bequest, and God class. The random-search algorithm was used to tune the parameters of Random Forest and Decision Tree. Results show that the best classification accuracy for Decision Tree was obtained at 99.13% for refused parent bequest code smells. Results also show that after using the Random Forest classifier, refused parent bequest smell was predicted with the best accuracy of 99.14%. Finally, in this research study, a set of code smell prediction rules were extracted using Decision Tree.

Subject Classification:

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.