首页 | 官方网站   微博 | 高级检索  
     


Does your code need comment?
Authors:Yuan Huang  Nan Jia  Junhuai Shu  Xinyu Hu  Xiangping Chen  Qiang Zhou
Affiliation:1. School of Data and Computer Science, Sun Yat-sen University, Guangzhou, China;2. School of Management Science and Engineering, Hebei GEO University, Shijiazhuang, China;3. Guangdong Key Laboratory for Big Data Analysis and Simulation of Public Opinion, School of Communication and Design, Sun Yat-sen University, Guangzhou, China
Abstract:Code comments convey information about the programmers' intention in a more explicit but less rigorous manner than source code. This information can assist programmers in various tasks, such as code comprehension, reuse, and maintenance. To better understand the properties of the comments existing in the source code, we analyzed more than 450 000 comments across 136 popular open-source software systems coming different domains. We found that the methods involving header comments and internal comments were shown low percentages in software systems, ie, 4.4% and 10.27%, respectively. As an application of our findings, we propose an automatic approach to determine whether a method needs a header comment, known as commenting necessity identification. Specifically, we identify the important factors for determining the commenting necessity of a method and extract them as structural features, syntactic features, and textual features. Then, by applying machine learning techniques and noise-handling techniques, we achieve a precision of 88.5% on eight open-source software from GitHub. The encouraging experimental results demonstrate the feasibility and effectiveness of our approach.
Keywords:code comment analysis  commenting necessity  comment density analysis  header comment
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司    京ICP备09084417号-23

京公网安备 11010802026262号