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

Published in Empirical Software Engineering (EMSE), 2021

Arxiv, Paper, Data, Replication package

ABSTRACT

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.