摘要
在现代软件开发和维护中重构是提高软件可维护性和软件质量的常用手段。而大量重构模式掺杂在日常的bug修复、功能增加等代码变更中,使得变更理解变得非常复杂。因此,提出一种对常见的抽取方法和抽取类重构模式的识别算法。研究基于工具Change Distiller和JDiff分别获取变更类型和抽取代码块,通过判断移动后的代码块与原文件变更代码的关系,识别采取的重构模式。该算法在4个开源项目中进行实验,其平均准确率在80%左右。
Refactoring is a common way of improving software maintainability and software quality in modern software development and maintenance. In daily revision,refactoring patterns are usually mixed with code changes accomplishing other tasks such as bug fixing and feature addition,which makes the change understanding very complicated. The paper proposes an identifying algorithm for refactoring patterns including the extract method and extract class. It is based on ChangeDistiller and JDiff that are used to get code changes types and extract code blocks respectively. Then,the algorithm will identify the refactoring pattern according to the characteristics of the relationship between the changed codes and the original codes. The algorithm has been tested on 4 open source projects,with an average 80% accuracy.
作者
孙美荣
杨春花
SUN Meirong;YANG Chunhua(School of Information, Qilu University of Technology ( Shandong Academy of Sciences), Jinan 250353, Chin)
出处
《智能计算机与应用》
2018年第2期25-29,34,共6页
Intelligent Computer and Applications
关键词
重构模式
抽取方法
抽取类
refactoring patterns
extract me^od
extract class