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.
翻译:守则评论在方案理解活动中发挥着突出作用。 但是,源代码并不总是有文件记录,代码和评论并不总是共同演变。为了处理这些问题,研究人员提出了自动生成注释以记录手头的某一代码的技术。该领域的最新工作运用了深层次学习(DL)技术来支持这项任务。尽管取得了进步,对这些方法的经验评价表明,它们仍然远远没有达到能使其对开发者有价值的业绩水平。我们处理了一个简单和相关的问题:代码评论完成。我们没有从头开始为某一代码产生评论,而是调查了最先进的技术能够在多大程度上帮助开发者更快地撰写评论。我们提出了一个大规模研究,我们从经验上评估了简单的n-gram模型和最近提议的文本到Text转换器(T5)结构如何在自动完成对开发者正在输入的代码评论方面能够发挥作用。所取得的结果显示了T5模型的优越性,尽管n-gram模型是一种竞争性的解决办法。