Previous studies have characterized code comments in different programming languages. However, very few studies have focused on the analysis of the information embedded in code comments. None of them compared the developer's practices to write the comments to the standard guidelines and analyzed these characteristics in the Pharo Smalltalk environment. The class commenting practices have their origins in Smalltalk-80, going back 40 years. Smalltalk offers a brief template for entering a comment for newly-created classes. These templates have evolved over the years, particularly in the Pharo environment. This paper reports the first empirical study investigating commenting practices in Pharo Smalltalk. We quantitatively and qualitatively analyze class comments of the most recent version of Pharo, to investigate the information types of Pharo comments. Finally, we study the adherence of developer commenting practices to the class template over Pharo versions. The results show 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 ratio. Additionally, we found that 23 information types are typically embedded in class comments and only seven of them are present in the latest Pharo class comment template. However, the information types proposed by the standard 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 written and formatted in a non-uniform way. This suggests the need to standardize the commenting guidelines for formatting the text to ensure a consistent style, and to identify the information easily.
翻译:先前的研究用不同的编程语言描述代码评论,然而,很少的研究侧重于分析代码评论中所含信息,但没有一项研究将开发商在标准准则中撰写评论并分析这些特征方面的实践与标准准则比较,没有一项研究将开发商在标准准则中编写评论和分析这些特征的做法进行比较。 班级评论做法起源于Smalltalk-80,可追溯到40年前。 Smalltalk为新创建班级输入评论提供了一个简短的模板。这些模板多年来一直在演变,特别是在法罗环境中。本文报告了第一次经验性研究,调查法罗小谈中评论做法。我们从数量和质量上分析最新版本法罗评论中的分类评论,以调查法罗评论的信息类型。最后,我们研究了开发商在法罗版本中评论做法的坚持程度。结果显示,最初三个法罗版本的班级评论迅速增加,而后来版本的开发商家则在新旧班级中增加了评论,从而保持了类似的比例。 此外,我们发现23种信息类型通常包含在课堂评论中,只有7种在最新版本中提供法罗评论格式。 然而,这类信息类型往往倾向于采用其他格式。