注释是否遵循注释规范?Java与Python案例研究
Do Comments follow Commenting Conventions? A Case Study in Java and Python
AI总结:
该研究分析Java和Python注释规范及开发者实践,发现规范偏重内容且覆盖不足,实际注释行为与指南存在明显不匹配,并为质量检查工具改进提供方向。
摘要:
评估代码注释质量是一个公认的难题。人们已经制定了许多编码风格指南,旨在鼓励编写信息丰富、可读且一致的注释。然而,从迄今为止的研究来看,尚不清楚这些指南涵盖了注释的哪些具体方面(例如语法、内容、结构)。此外,开发人员在编写代码注释时遵循这些指南的程度也不得而知。我们分析了Java和Python中的各种风格指南,发现其中大多数更多地关注注释的内容方面,而非语法或格式;但当考虑开发人员嵌入注释中的不同类型信息,以及他们在各类在线平台上对注释实践提出的担忧时,现有注释约定仍规定得不够明确,也没有充分覆盖重要关切。我们还分析了开发人员在不同项目中的注释实践,以考察他们遵循指南的程度。我们的结果凸显了开发人员注释实践与风格指南之间的不匹配,并为注释质量检查工具的设计和改进提供了若干重点方向。
英文摘要:
Assessing code comment quality is known to be a difficult problem. A number of coding style guidelines have been created with the aim to encourage writing of informative, readable, and consistent comments. However, it is not clear from the research to date which specific aspects of comments the guidelines cover (e.g., syntax, content, structure). Furthermore, the extent to which developers follow these guidelines while writing code comments is unknown. We analyze various style guidelines in Java and Python and uncover that the majority of them address more the content aspect of the comments rather than syntax or formatting, but when considering the different types of information developers embed in comments and the concerns they raise on various online platforms about the commenting practices, existing comment conventions are not yet specified clearly enough, nor do they adequately cover important concerns. We also analyze commenting practices of developers in diverse projects to see the extent to which they follow the guidelines. Our results highlight the mismatch between developer commenting practices and style guidelines, and provide several focal points for the design and improvement of comment quality checking tools.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。