A Comment Analysis Approach for Program Comprehension

Jose Luis Freitas, Daniela Carneiro da Cruz, P. Henriques
{"title":"A Comment Analysis Approach for Program Comprehension","authors":"Jose Luis Freitas, Daniela Carneiro da Cruz, P. Henriques","doi":"10.1109/SEW.2012.8","DOIUrl":null,"url":null,"abstract":"Comments are interspersed by the Programmer among code lines, at software development phase, with two main purposes: to help himself during the development phase; to help other programmers later on, during the maintenance phase. The former are memos to help him remembering to do something; they are not useful for those willing to understand code. The latter are explanations about the ideas he has in mind when he wrote the code; they can be a relevant aid for others and should be taken into consideration as a first step in program comprehension. Comments are scattered all over the source code, sometimes wrapping a block of code (placed at the beginning or at its end), other times complementing a single statement. If comments are inserted to help in understanding the programmer ideas, they will contain for sure concepts associated with problem domain In this paper we discuss an approach to locate a relevant code chunk (one where the programmer should focus the attention for software maintenance), using information retrieval techniques to locate problem domain concepts within comments. In our approach, comments are isolated marking their type (inline, block or javadoc comment) and keeping their context (code lines to which they are associated). Picking up concepts from the ontology that describes the problem, it is possible to find all the comments that contain that concept (similar words) and rate them. Reading comments from the retrieved list, the programmer can select those that seem to him meaningful and dive directly into the associated chunk. In the paper, we also survey Comment Analysis techniques and describe an environment, Darius, that aims at automatizing the approach proposed. Moreover, Darius provides functionality to study comments frequency in the source files of a given project, to support the discussion weather it is worthwhile or not to apply this program comprehension step.","PeriodicalId":150723,"journal":{"name":"2012 35th Annual IEEE Software Engineering Workshop","volume":"270 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2012-10-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"15","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2012 35th Annual IEEE Software Engineering Workshop","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/SEW.2012.8","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 15

Abstract

Comments are interspersed by the Programmer among code lines, at software development phase, with two main purposes: to help himself during the development phase; to help other programmers later on, during the maintenance phase. The former are memos to help him remembering to do something; they are not useful for those willing to understand code. The latter are explanations about the ideas he has in mind when he wrote the code; they can be a relevant aid for others and should be taken into consideration as a first step in program comprehension. Comments are scattered all over the source code, sometimes wrapping a block of code (placed at the beginning or at its end), other times complementing a single statement. If comments are inserted to help in understanding the programmer ideas, they will contain for sure concepts associated with problem domain In this paper we discuss an approach to locate a relevant code chunk (one where the programmer should focus the attention for software maintenance), using information retrieval techniques to locate problem domain concepts within comments. In our approach, comments are isolated marking their type (inline, block or javadoc comment) and keeping their context (code lines to which they are associated). Picking up concepts from the ontology that describes the problem, it is possible to find all the comments that contain that concept (similar words) and rate them. Reading comments from the retrieved list, the programmer can select those that seem to him meaningful and dive directly into the associated chunk. In the paper, we also survey Comment Analysis techniques and describe an environment, Darius, that aims at automatizing the approach proposed. Moreover, Darius provides functionality to study comments frequency in the source files of a given project, to support the discussion weather it is worthwhile or not to apply this program comprehension step.
用于程序理解的注释分析方法
在软件开发阶段,程序员将注释穿插在代码行之间,主要有两个目的:在开发阶段帮助自己;在以后的维护阶段帮助其他程序员。前者是帮助他记住要做某事的备忘录;对于那些愿意理解代码的人来说,它们是没有用的。后者是关于他在编写代码时所想到的想法的解释;它们可以对其他人提供相关的帮助,并且应该作为程序理解的第一步加以考虑。注释分散在整个源代码中,有时包含一个代码块(放在开头或结尾),有时补充单个语句。如果插入注释是为了帮助理解程序员的想法,那么它们肯定包含与问题域相关的概念。在本文中,我们讨论了一种定位相关代码块的方法(程序员应该将注意力集中在软件维护上),使用信息检索技术在注释中定位问题域概念。在我们的方法中,注释是隔离的,标记了它们的类型(内联、块或javadoc注释),并保留了它们的上下文(与它们相关联的代码行)。从描述问题的本体中选取概念,可以找到包含该概念(类似的单词)的所有评论并对其进行评分。从检索到的列表中阅读评论,程序员可以选择那些他认为有意义的,并直接进入相关的块。在本文中,我们还调查了评论分析技术,并描述了一个环境,Darius,旨在使所提出的方法自动化。此外,Darius提供了在给定项目的源文件中研究注释频率的功能,以支持讨论是否值得应用这个程序理解步骤。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信