Identification of refactoring opportunities for source code based on class association relationships  

基于类关联关系的源代码重构时机识别

在线阅读下载全文

作  者:LIU Wei YANG Na HUANG Xin-di HU Wei HU Zhi-gang 刘伟;杨娜;黄辛迪;胡为;胡志刚(School of Informatics,Hunan University of Chinese Medicine,Changsha 410208,China;School of Computer Science and Engineering,Central South University,Changsha 410083,China)

机构地区:[1]School of Informatics,Hunan University of Chinese Medicine,Changsha 410208,China [2]School of Computer Science and Engineering,Central South University,Changsha 410083,China

出  处:《Journal of Central South University》2020年第12期3768-3778,共11页中南大学学报(英文版)

摘  要:In order to deal with the complex association relationships between classes in an object-oriented software system,a novel approach for identifying refactoring opportunities is proposed.The approach can be used to detect complex and duplicated many-to-many association relationships in source code,and to provide guidance for further refactoring.In the approach,source code is first transformed to an abstract syntax tree from which all data members of each class are extracted,then each class is characterized in connection with a set of association classes saving its data members.Next,classes in common associations are obtained by comparing different association classes sets in integrated analysis.Finally,on condition of pre-defined thresholds,all class sets in candidate for refactoring and their common association classes are saved and exported.This approach is tested on 4 projects.The results show that the precision is over 96%when the threshold is 3,and 100%when the threshold is 4.Meanwhile,this approach has good execution efficiency as the execution time taken for a project with more than 500 classes is less than 4 s,which also indicates that it can be applied to projects of different scales to identify their refactoring opportunities effectively.针对面向对象软件系统中类与类之间存在的复杂关联关系,提出了一种基于类关联关系的代码重构时机识别方法,可用于探测代码中存在的重复多对多关联关系,为进一步实施重构提供指导。该方法首先将源代码转换成抽象语法树,然后提取每一个类的成员变量,得到每一个类的关联类集,再寻找类之间的公共关联类,最后根据设定的阈值,保存并输出满足预定条件的候选重构类集以及它们的公共关联类。通过对四个项目进行重构时机识别实验,结果表明,当阈值为3时,方法的精确率超过96%,当阈值为4时精确率达到100%。同时,方法具有较好的执行效率,对于超过500个类的项目,识别程序的执行时间不到4 s,说明该方法可有效应用于不同规模项目的重构时机识别。

关 键 词:identification of refactoring opportunities abstract syntax tree class association relationships common association classes source code 

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

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

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