期刊文献+

基于K-最近邻的C克隆代码重构方法

Code Clone Restructuring of C Programs Via K-nearest Neighbor Algorithm
下载PDF
导出
摘要 在软件开发过程中,克隆代码已经成为引起软件缺陷的一个重要因素。针对现有的方法不能很好地处理内聚度低、功能交叉的克隆代码的问题,提出了一种基于K-最近邻的克隆代码重构方法。首先,对克隆代码进行静态分析,搜集控制依赖信息和数据流信息,再经过K-最近邻聚类方法,形成便于提取、功能独立的代码片段,然后对代码片段进行过程提取,使之成为一个独立的过程,并用过程调用替代原来的克隆代码。实验结果表明,该方法能够对克隆代码进行有效组织,并对功能独立的部分进行提取。 In the development of software, code clones have been one of important causes for software defects. To solve the problem that the existing methods can not effectively handle low-cohesion and cross-functional code clones, this paper proposes a code clone restructuring approach based on k-nearest neighbor algorithm. Firstly, code clones are statically analyzed, and thereby the control dependency information and data flow information are collected. Then, k-nearest neighbor clustering algorithm is performed to form extractable or functional-independence code fragments. After that, a procedure extraction algorithm is performed on these code fragments to extract independent procedures. Finally, original code clones are replaced by the invocations of their corresponding procedures. Experiment results show that this method can effectively reorganize the structure of code clones and perform the extraction on functional independent code fragments.
作者 冯江辉 王甜甜 苏小红 马培军 FENG Jianghui, WANG Tiantian, SU Xiaohong, MA Peijun (School of Computer Science & Technology, Harbin Institute of Technology, HarDin, Heilongjiang, 150001)
出处 《智能计算机与应用》 2011年第1X期47-50,共4页 Intelligent Computer and Applications
基金 国家自然科学基金(61073052) 高等学校博士学科点专项科研基金(20092302110040).
关键词 重构 K-最近邻聚类算法 过程提取 静态分析 Restructuring K-nearest Neighbor Clustering Algorithm Procedure Extraction Static Analysis
  • 相关文献

参考文献9

  • 1KOMONDOOR R,HORWITZ S.Effective,automatic procedu-re extraction. Proc.of the International Workshop on ProgramComprehension . 2003
  • 2ALKHALID A,YEB M A,MAHMOUD S.Software refactoringat the function level using new Adaptive K-Nearest Neighbor a-lgorithm. Advances in Engineering . 2010
  • 3LUNG C H,XU X,ZAMAN Me,t al.Program restructuring us-ing clustering techniques. The Journal of Systems and Soft-ware . 2006
  • 4Lakhotia A,,Deprez J-C.Restructuring programs by tucking statements into functions. Information and Software Technology . 1998
  • 5M. Harman,D. W. Binkely,and S. Dancic.Amorphous program slicing. The Journal of Systems and Software . 2003
  • 6Raghavan Komondoor,,Susan Horwitz.Semantics-Preserving Procedure Extraction. Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages . 2000
  • 7William G. Griswold.Program Restructuring as an Aid to Software Maintenance. . 1991
  • 8W. G. Griswold,D. Notkin.Automated assistance for program restructuring. ACM Transactions on Software Engineering and Methodology . 1993
  • 9Burstall R M,Darlington J A.A transformation system for developing recursive programs. The Journal of The American Medical Association . 1977

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部