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.
翻译:先前的研究对各种编程语言的代码评论进行了定性,以支持更好地规划理解活动和维护任务。然而,很少有研究侧重于理解开发者编写评论的做法,没有一项研究将这类开发者做法与标准评论准则进行比较,以研究开发者遵循准则的程度。本文报告了第一次经验研究,调查法罗·斯马约克(Pharo Smallaltalk)中的评论做法。首先,我们分析七个法罗版本中的类评论演变情况。然后,我们调查各类评论中所含的信息类型。最后,我们研究开发者对法罗版本的官方级评论模板的评论做法的遵守情况。本研究的结果表明,最初三个法罗版本中的类评论迅速增加,而随后版本的开发者则在新旧版本中都增加了评论,从而保持了类似评论比率。我们发现,类评论中的三种信息类型比模板中建议的信息类型要多三倍。我们发现,模板中的信息类型往往比其他类型的信息更经常出现。我们发现,大量的评论都遵循这些信息类型中的格式格式的写法格式格式,但是它们以书面和格式方式将质量评论迅速地增加,但以书面和格式的方式向不同格式提供格式的版本。