ABSTRACT
Comments are essential components of programming languages: they preserve the developer's intentions, help the maintainers to understand hidden concepts, and may act as a source of automatic documentation generation. However most of the software maintenance tools (refactorers, slicing and analyser tools) ignore them therefore they lose an important part of information about the software. One of the reasons why tools neglect comments is that there is no single well-defined location in the software's AST where to place them. The relationship between the program's control structure and the comments depend on code conventions and human habits. Our research -- part of a project to develop a software maintenance tool -- focuses on the code comprehension process of large legacy C++ projects and heavily utilize code comments. We evaluated the commenting behaviour used in large projects and categorized the major patterns. We found that these patterns are strongly correlating in a single project. In the paper we present a method to find the correct place of the comments in the AST-based on project-specific rules. We evaluate our method and test it against open source C++ projects.
- Clang. http://clang.llvm.org/.Google Scholar
- Libre Office. http://www.libreoffice.org/.Google Scholar
- LLVM. http://llvm.org/.Google Scholar
- Mozilla Firefox. http://www.mozilla.org/en-US/firefox.Google Scholar
- V8 JavaScript Engine. http://code.google.com/p/v8/.Google Scholar
- VirtualBox. https://www.virtualbox.org/.Google Scholar
- I. F. Darwin. Java Cookbook. O'Reilly, Sebastopol, CA, 2004.Google Scholar
- A. Köhler. Der C/C++-Projektbegleiter. dpunkt.verlag, 69115 Heidelberg, 2007.Google Scholar
- E. T. Ray. Learning XML. O'Reilly, Sebastopol, CA, 2003. Google ScholarDigital Library
- P. Sommerlad, G. Zgraggen, T. Corbat, and L. Felber. Retaining comments when refactoring code. In Companion to the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications, OOPSLA Companion '08, pages 653--662, New York, NY, USA, 2008. ACM. Google ScholarDigital Library
- G. Sridhara, L. Pollock, and K. Vijay-Shanker. Generating parameter comments and integrating with method summaries. In Program Comprehension (ICPC), 2011 IEEE 19th International Conference on, pages 71--80, june 2011. Google ScholarDigital Library
- B. Stroustrup. The C++ Programming Language Special Edition. Addison-Wesley, Reading, MA, 2000. Google ScholarDigital Library
- L. Tan, D. Yuan, G. Krishna, and Y. Zhou./* icomment: bugs or bad comments? */. SIGOPS Oper. Syst. Rev., 41:145--158, October 2007. Google ScholarDigital Library
- L. Tan, Y. Zhou, and Y. Padioleau. acomment: mining annotations from comments and code to detect interrupt related concurrency bugs. In Proceeding of the 33rd International Conference on Software Engineering, ICSE '11, pages 11--20, New York, NY, USA, 2011. ACM. Google ScholarDigital Library
Index Terms
- Rule-based assignment of comments to AST nodes in C++ programs
Recommendations
Comments-oriented blog summarization by sentence extraction
CIKM '07: Proceedings of the sixteenth ACM conference on Conference on information and knowledge managementMuch existing research on blogs focused on posts only, ignoring their comments. Our user study conducted on summarizing blog posts, however, showed that reading comments does change one's understanding about blog posts. In this research, we aim to ...
The politics of comments: predicting political orientation of news stories with commenters' sentiment patterns
CSCW '11: Proceedings of the ACM 2011 conference on Computer supported cooperative workPolitical views frequently conflict in the coverage of contentious political issues, potentially causing serious social problems. We present a novel social annotation analysis approach for identification of news articles' political orientation. The ...
Do comments explain codes adequately?: investigation by text filtering
MSR '11: Proceedings of the 8th Working Conference on Mining Software RepositoriesComment lines in the software source code include descriptions of codes, usage of codes, copyrights, unused codes, comments, and so on. It is required for comments to explain the content of written code adequately, since the wrong description in the ...
Comments