Where should I comment my code?

Where should I comment my code?
复制标题

我应该在哪里注释我的代码?

DOI:
10.1145/3377816.3381736
复制
发表时间:
2020
期刊:
--
影响因子:
--
通讯作者:
Louis A
Louis A
中科院分区:
--
文献类型:
--
作者:
Louis A

文献摘要

相似文献

程序员应该写代码注释,但不是在每一行代码上。我们已经创建了一个机器学习模型,它可以建议程序员应该在哪里写代码注释。我们在现有的注释代码上训练它来学习开发人员选择的位置。经过训练后,该模型可以预测新代码中的位置。我们的模型在确定值得评论的位置时达到了74%的精度和13%的召回率。这第一次成功为未来的工作打开了大门,无论是在新的评论问题和指导评论生成方面。我们的代码和数据可在http://groups.inf.ed.ac.uk/cup/comment-locator/上获得。
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 newwhere-to-commentproblem and in guiding comment generation. Our code and data is available at http://groups.inf.ed.ac.uk/cup/comment-locator/.