Where should I comment my code?
Annie Priyadarshini Louis, Santanu Kumar Dash, Earl T. Barr et al. · 2020
Programmers should write code comments, but not on every line of code. We have created a machine learning model that suggests locations where a programmer should write a code comment. We trained it on existing commented code to learn locations that are chosen by developers. Once trained, the model can predict locations in new code. Our models achieved precision of 74% and recall of 13% in identifying comment-worthy locations. This first success opens the door to future work, both in the new where-to-comment problem and in guiding comment generation. Our code and data is available at http://groups.inf.ed.ac.uk/cup/comment-locator/.
Cited by 5 works. doi:10.1145/3377816.3381736 Open-access PDF
Authors
References
- Refactoring: Improving the Design of Existing Code
- Code complete: a practical handbook of software construction
- Deep code comment generation
- /*icomment
- Automatically documenting program changes
- Natural Language Models for Predicting Programming Comments
- @tComment: Testing Javadoc Comments to Detect Comment-Code Inconsistencies
- aComment
- /*icomment
- Automatic generation of oracles for exceptional behaviors