Investigating Novice Developers’ Code Commenting Trends Using Machine Learning Techniques

Niazi, Tahira, Das, Teerath, Ahmed, Ghufran, Waqas, Syed Muhammad, Khan, Sumra, Khan, Suleman, Abdelatif, Ahmed Abdelaziz and Wasi, Shaukat (2023) Investigating Novice Developers’ Code Commenting Trends Using Machine Learning Techniques. Algorithms, 16 (1). p. 53.

[thumbnail of VOR]
PDF (VOR) - Published Version
Available under License Creative Commons Attribution.


Official URL:


Code comments are considered an efficient way to document the functionality of a particular block of code. Code commenting is a common practice among developers to explain the purpose of the code in order to improve code comprehension and readability. Researchers investigated the effect of code comments on software development tasks and demonstrated the use of comments in several ways, including maintenance, reusability, bug detection, etc. Given the importance of code comments, it becomes vital for novice developers to brush up on their code commenting skills. In this study, we initially investigated what types of comments novice students document in their source code and further categorized those comments using a machine learning approach. The work involves the initial manual classification of code comments and then building a machine learning model to classify student code comments automatically. The findings of our study revealed that novice developers/students’ comments are mainly related to Literal (26.66%) and Insufficient (26.66%). Further, we proposed and extended the taxonomy of such source code comments by adding a few more categories, i.e., License (5.18%), Profile (4.80%), Irrelevant (4.80%), Commented Code (4.44%), Autogenerated (1.48%), and Improper (1.10%). Moreover, we assessed our approach with three different machine-learning classifiers. Our implementation of machine learning models found that Decision Tree resulted in the overall highest accuracy, i.e., 85%. This study helps in predicting the type of code comments for a novice developer using a machine learning approach that can be implemented to generate automated feedback for students, thus saving teachers time for manual one-on-one feedback, which is a time-consuming activity.

Repository Staff Only: item control page