/*icomment: bugs or bad comments?*/

  • Authors:
  • Lin Tan;Ding Yuan;Gopal Krishna;Yuanyuan Zhou

  • Affiliations:
  • University of Illinois: Urbana-Champaign, Urbana, IL;University of Illinois: Urbana-Champaign, Urbana, IL;University of Illinois: Urbana-Champaign, Urbana, IL;University of Illinois: Urbana-Champaign, Urbana, IL

  • Venue:
  • Proceedings of twenty-first ACM SIGOPS symposium on Operating systems principles
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.