/*icomment: bugs or bad comments?*/

/*icomment: bugs or bad comments?*/
复制标题

DOI:
10.1145/1294261.1294276
复制
发表时间:
2007-10
期刊:
--
影响因子:
--
通讯作者:
Lin Tan;Ding Yuan;G. Krishna;Yuanyuan Zhou
Lin Tan;Ding Yuan;G. Krishna;Yuanyuan Zhou
中科院分区:
其他
文献类型:
--
作者:
Lin Tan;Ding Yuan;G. Krishna;Yuanyuan Zhou

文献摘要

被引文献

相似文献

注释源代码长期以来一直是软件开发中的常见做法。与源代码相比,注释更直接,描述性更强,更容易理解。注释和源代码提供了关于程序语义行为的相对冗余和独立的信息。随着软件的发展,它们很容易变得不同步,这表明了两个问题:(1)bug-源代码不遵循正确的程序注释所指定的假设和要求;(2)坏注释-与正确代码不一致的注释,这可能会混淆和误导程序员在后续版本中引入bug。不幸的是,由于大多数注释都是用自然语言编写的,因此还没有提出自动分析注释并检测注释和源代码之间不一致的解决方案。本文首先对自然语言注释进行自动分析,提取隐含的程序规则,并利用这些规则自动检测注释与源代码之间的不一致性,指出错误或不良注释。我们的解决方案iComment结合了自然语言处理(NLP)、机器学习、统计和程序分析技术来实现这些目标。我们在四个大型代码库上评估iComment:Linux,Mozilla,Wine和Apache。我们的实验结果表明,iComment自动提取1832规则的评论与90.8-100%的准确率,并检测60注释代码不一致,33 newbugs和27坏评论,在最新版本的四个程序。其中19个(12个bug和7个坏评论)已经被相应的开发人员确认,而其他的开发人员目前正在分析中。
Commenting source code has long been a common practice in software development. Compared to source code, comments are more direct, descriptive and easy-to-understand. Comments and sourcecode provide relatively redundant and independent information regarding a program's semantic behavior. As software evolves, they can easily grow out-of-sync, indicating two problems: (1) bugs -the source code does not follow the assumptions and requirements specified by correct program comments; (2) bad comments - comments that are inconsistent with correct code, which can confuse and mislead programmers to introduce bugs in subsequent versions. Unfortunately, as most comments are written in natural language, no solution has been proposed to automatically analyze commentsand detect inconsistencies between comments and source code. This paper takes the first step in automatically analyzing commentswritten in natural language to extract implicit program rulesand use these rules to automatically detect inconsistencies between comments and source code, indicating either bugs or bad comments. Our solution, iComment, combines Natural Language Processing(NLP), Machine Learning, Statistics and Program Analysis techniques to achieve these goals. We evaluate iComment on four large code bases: Linux, Mozilla, Wine and Apache. Our experimental results show that iComment automatically extracts 1832 rules from comments with 90.8-100% accuracy and detects 60 comment-code inconsistencies, 33 newbugs and 27 bad comments, in the latest versions of the four programs. Nineteen of them (12 bugs and 7 bad comments) have already been confirmed by the corresponding developers while the others are currently being analyzed by the developers.