融合结构与语义特征的代码注释决策支持方法  被引量:6

Method Combining Structural and Semantic Features to Support Code Commenting Decision

在线阅读下载全文

作  者:黄袁[1,2] 贾楠 周强[1,2] 陈湘萍 熊英飞[5,6] 罗笑南 HUANG Yuan;JIA Nan;ZHOU Qiang;CHEN Xiang-Ping;XIONG Ying-Fei;LUO Xiao-Nan(School of Data and Computer Science,Sun Yat-sen University,Guangzhou 510006,China;National Engineering Research Center of Digital Life,Guangzhou 510006,China;Institute of Advanced Technology,Sun Yat-sen University,Guangzhou 510006,China;Institute of Software,School of Electronics Engineering and Computer Science,Peking University,Beijing 100871,China;Key Laboratory of High Confidence Software Technologies(Peking University),Ministry of Education,Beijing 100871,China;School of Management Science and Engineering,Hebei GEO University,Shijiazhuang 050031,China)

机构地区:[1]中山大学数据科学与计算机学院,广东广州510006 [2]国家数字家庭工程技术研究中心,广东广州510006 [3]河北地质大学管理科学与工程学院,河北石家庄050031 [4]中山大学先进技术研究院,广东广州510006 [5]北京大学信息科学技术学院软件研究所,北京100871 [6]高可信软件技术教育部重点实验室(北京大学),北京100871

出  处:《软件学报》2018年第8期2226-2242,共17页Journal of Software

基  金:国家重点研发计划(2016YFB1000101);国家自然科学基金(61672545;61402546);广东省科技计划项目(2013B0907 00009);中山市科技计划项目(2016A1044)~~

摘  要:代码注释是辅助编程人员理解源代码的有效手段之一.高质量的注释决策不仅能够覆盖软件系统中的核心代码片段,还能避免产生多余的代码注释.然而在实际开发中,编程人员往往缺乏统一的注释规范,大部分的注释决策都取决于个人经验以及领域知识.对于新手程序员来说,注释决策显然成为一项重要而艰巨的任务.为了减少编程人员投入过多的精力在注释决策上,从大量的代码注释实例中学习出一种通用的注释决策规范,并提出了CommentAdviser方法,以辅助编程人员在代码开发过程中做出恰当的注释决策.由于注释决策与代码本身的上下文信息密切相关,因此,从当前代码行的上下文代码中提取代码结构特征以及代码语义特征作为支持注释决策的主要依据.然后,利用机器学习算法判定当前代码行是否为可能的注释点.在GitHub中的10个大型开源软件的数据集上评估了所提出的方法,实验结果以及用户调研表明,代码注释决策支持CommentAdviser方法的可行性和有效性.Code comment is quite important to help developer review and comprehend source code. Strategic comment decision is desired to cover core code snippets of software system without incurring unintended trivial comments. However, in current practice, there is a lack of rigorous specifications for developers to make their comment decisions. Commenting has become an important yet tough decision which mostly depends on the personal experience of developers. To reduce the effort on making comment decisions, this paper investigates a unified commenting regulation from a large number of commenting instances. A method, CommentAdviser, is proposed to guide developers in placing comments in source code. Since making comment is closely related to the context information of source code themselves, the method identifies this important factor for determining where to comment and extract them as structural context feature and semantic context feature. Next, machine learning techniques are applied to identify the possible commenting locations in source code. CommentAdviser is evaluated on 10 data sets from GitHub. The experimental results, as well as a user study, demonstrate the feasibility and effectiveness of CommentAdviser.

关 键 词:代码注释 结构特征 语义特征 机器学习 注释决策 

分 类 号:TP311[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象