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

类注释告诉我们什么?Pharo Smalltalk中的评论演变与实践

What do class comments tell us? An investigation of comment evolution and practices in Pharo Smalltalk

Pooja Rani, Sebastiano Panichella, Manuel Leuenberger, Mohammad Ghafari, Oscar Nierstrasz

摘要:

先前的研究已经描述了各种程序设计语言中的代码注释,以支持更好的程序理解活动和维护任务。然而,很少有研究关注于理解开发人员编写注释的实践。他们都没有将这些开发人员的做法与标准评论指南进行比较,以研究开发人员遵循指南的程度。本文报道了第一个实证研究调查的评论实践中的Pharo Smalltalk。首先,我们分析了七个Pharo版本的类注释演化。然后,我们研究嵌入类注释中的信息类型。最后,我们研究了开发人员评论实践的遵守官方类评论模板的Pharo版本。这项研究的结果表明,在最初的三个Pharo版本中,类注释迅速增加,而在随后的版本中,开发人员向新类和旧类添加了注释,从而保持了类似的代码注释比例。我们还发现,课堂注释中的信息类型是模板所建议的信息类型的三倍。然而,模板所建议的信息类型往往比其他类型的信息更频繁地出现。此外,我们发现相当一部分的注释在书写这些信息类型时遵循模板的书写风格,但它们的书写和格式并不统一。这表明需要标准化文本格式的注释指南,并为不同的信息类型提供标题,以确保一致的风格并易于识别信息。考虑到高质量代码注释的重要性,我们为开发人员和研究人员提供了许多建议,以提高对注释质量评估工具的支持。

英文摘要:

Previous studies have characterized code comments in various programming languages to support better program comprehension activities and maintenance tasks. However, very few studies have focused on understanding developer practices to write comments. None of them has compared such developer practices to the standard comment guidelines to study the extent to which developers follow the guidelines. This paper reports the first empirical study investigating commenting practices in Pharo Smalltalk. First, we analyze class comment evolution over seven Pharo versions. Then, we investigate the information types embedded in class comments. Finally, we study the adherence of developer commenting practices to the official class comment template over Pharo versions. The results of this study show that there is a rapid increase in class comments in the initial three Pharo versions, while in subsequent versions developers added comments to both new and old classes, thus maintaining a similar code to comment ratio. We furthermore found three times as many information types in class comments as those suggested by the template. However, the information types suggested by the template tend to be present more often than other types of information. Additionally, we find that a substantial proportion of comments follow the writing style of the template in writing these information types, but they are written and formatted in a non-uniform way.This suggests the need to standardize the commenting guidelines for formatting the text, and to provide headers for the different information types to ensure a consistent style and to identify the information easily. Given the importance of high-quality code comments, we draw numerous implications for developers and researchers to improve the support for comment quality assessment tools.

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

↑