Java代码注释中有关原始变量知识的刻画
Characterising the Knowledge about Primitive Variables in Java Code Comments
摘要:
基元类型是任何程序设计语言中可用的基本组件,用作数据操作的构建块。理解这些类型在源代码中的作用对于编写软件至关重要。关于这些变量在代码注释中记录的频率以及注释提供的关于原始类型变量的知识类型,几乎没有进行过研究。在本文中,我们提出了一种方法来检测原始变量和他们的描述在评论中使用词法匹配和高级匹配。我们通过比较词汇和高级匹配在召回率,精度和F分数方面的性能来评估我们的方法,并与来自GitHub项目样本的600个手动注释变量进行比较。我们的先进的方法的基础上的F分数的性能优于词汇匹配,分别为0.986和0.942。然后,我们创建一个分类的知识类型包含在这些评论的变量的基本类型。我们的研究表明,开发人员通常会记录数字型数据类型变量的标识符及其目的~(69.16%)和概念~(72.75%),而记录较少的字符串类型变量的标识符的目的~(61.14%)和概念~(55.46%)。我们的研究结果证明了记录原始变量的实践的当前状态,并指出了通常没有很好记录的领域,例如布尔变量的含义或字段和局部变量的目的。
英文摘要:
Primitive types are fundamental components available in any programming language, which serve as the building blocks of data manipulation. Understanding the role of these types in source code is essential to write software. Little work has been conducted on how often these variables are documented in code comments and what types of knowledge the comments provide about variables of primitive types. In this paper, we present an approach for detecting primitive variables and their description in comments using lexical matching and advanced matching. We evaluate our approaches by comparing the lexical and advanced matching performance in terms of recall, precision, and F-score, against 600 manually annotated variables from a sample of GitHub projects. The performance of our advanced approach based on F-score was superior compared to lexical matching, 0.986 and 0.942, respectively. We then create a taxonomy of the types of knowledge contained in these comments about variables of primitive types. Our study showed that developers usually documented the variables' identifiers of a numeric data type with their purpose~(69.16%) and concept~(72.75%) more than the variables' identifiers of type String which were less documented with purpose~(61.14%) and concept~(55.46%). Our findings characterise the current state of the practice of documenting primitive variables and point at areas that are often not well documented, such as the meaning of boolean variables or the purpose of fields and local variables.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。