计算机应用 ›› 2014, Vol. 34 ›› Issue (6): 1788-1791.DOI: 10.11772/j.issn.1001-9081.2014.06.1788

• 计算机软件技术 • 上一篇    下一篇

基于潜在狄利克雷分配模型预测克隆代码不一致变化的可能

尹丽丽,张丽萍,王春辉,涂颖,刘东升   

  1. 内蒙古师范大学 计算机与信息工程学院,呼和浩特 010022
  • 收稿日期:2013-11-07 修回日期:2014-01-17 出版日期:2014-06-01 发布日期:2014-07-02
  • 通讯作者: 刘东升
  • 作者简介:尹丽丽(1987-), 女,内蒙古赤峰人,硕士研究生,主要研究方向:代码分析;张丽萍(1974-), 女,内蒙古呼和浩特人,副教授,主要研究方向:软件工程、代码分析;王春晖(1979-),女,内蒙古呼和浩特人,讲师,硕士,主要研究方向:软件工程、代码分析;刘东升(1956-),男,内蒙古呼和浩特人,教授,主要研究方向:软件工程、代码分析。
  • 基金资助:

    重庆市科委基础与前沿研究项目

Predicting inconsistent change probability of code clone based on latent Dirichlet allocation model

YI Lili,ZHANG Liping,WANG Chunhui,TU Ying,LIU Dongsheng   

  1. College of Computer and Information Engineering, Inner Mongolia Normal University, Hohhot Nei Mongol 010022, China
  • Received:2013-11-07 Revised:2014-01-17 Online:2014-06-01 Published:2014-07-02
  • Contact: LIU Dongsheng
  • Supported by:

    National Natural Science Foundation

摘要:

程序员对源代码的拷贝、粘贴及修改活动会导致软件中出现大量的克隆代码,而在版本的进化过程中,克隆代码的不一致变化是引起程序错误的主要原因,同时会增加维护成本。为了解决该问题,提出一种新的研究方法:首先构建版本间克隆群的映射关系,其次借助潜在狄利克雷分配(LDA)模型提取直系克隆群集主题,最后预测克隆代码不一致变化的可能性。对一款软件的8个版本进行了实验,实验结果的区分度明显,可以有效地预测不一致变化的可能性,评估软件质量和可信性。

Abstract:

The activities of the programmers including copy, paste and modify result in a lot of code clone in the software systems. However, the inconsistent change of code clone is the main reason that causes program error and increases maintenance costs in the evolutionary process of the software version. To solve this problem, a new research method was proposed. The mapping relationship between the clone groups was built at first. Then the theme of lineal cloning cluster was extracted using Latent Dirichlet Allocation (LDA) model. Finally, the inconsistent change probability of code clone was predicted. A software which contains eight versions was tested and an obvious discrimination was got. The experimental results show that the method can effectively predict the probability of inconsistent change and be used for evaluating quality and credibility of software.

中图分类号: