arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2107.10544cs.SE
收藏

代码注释完成的实证研究

An Empirical Study on Code Comment Completion

Antonio Mastropaolo, Emad Aghajani, Luca Pascarella, Gabriele Bavota

摘要:

代码注释在程序理解活动中起着重要的作用。然而,源代码并不总是文档化的,代码和注释并不总是共同发展的。为了解决这些问题,研究人员提出了自动生成注释的技术,这些注释记录了手头的给定代码。该领域的最新工作应用了深度学习(DL)技术来支持这样的任务。尽管取得了进展,这些方法的实证评估表明,他们仍然远远没有一个性能水平,使他们有价值的开发人员。我们解决了一个更简单的相关问题:代码注释完成。我们不是从头开始为给定的代码生成注释,而是研究最先进的技术可以在多大程度上帮助开发人员更快地编写注释。我们提出了一个大规模的研究,我们经验性地评估如何一个简单的n-gram模型和最近提出的文本到文本传输Transformer(T5)架构可以执行自动完成代码注释的开发人员键入。所取得的结果显示了T5模型的优越性,尽管n-gram模型是一个有竞争力的解决方案。

英文摘要:

Code comments play a prominent role in program comprehension activities. However, source code is not always documented and code and comments not always co-evolve. To deal with these issues, researchers have proposed techniques to automatically generate comments documenting a given code at hand. The most recent works in the area applied deep learning (DL) techniques to support such a task. Despite the achieved advances, the empirical evaluations of these approaches show that they are still far from a performance level that would make them valuable for developers. We tackle a simpler and related problem: Code comment completion. Instead of generating a comment for a given code from scratch, we investigate the extent to which state-of-the-art techniques can help developers in writing comments faster. We present a large-scale study in which we empirically assess how a simple n-gram model and the recently proposed Text-To-Text Transfer Transformer (T5) architecture can perform in autocompleting a code comment the developer is typing. The achieved results show the superiority of the T5 model, despite the n-gram model being a competitive solution.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑