期刊文献+

基于图模型和孤立森林的上帝类检测方法 被引量:1

God Class Detection Approach Based on Graph Model and Isolation Forest
下载PDF
导出
摘要 上帝类(God class)是指同时包含多种任务职责的类,其常见特征是包含大量的属性与方法,并且与系统中的其他类有多种依赖关系.上帝类是一种典型的代码坏味,对软件的开发维护产生负面影响.近年来,许多研究都致力于发现和重构上帝类,但是现有方法识别上帝类的能力不强,检测精确率不高.提出了一种基于图模型和孤立森林的上帝类检测方法,主要分为两个阶段:图结构信息分析阶段和类内度量评估阶段.在图结构信息分析阶段,建立类间的方法调用图和类内结构图,采用孤立森林算法缩小上帝类的检测范围;在类内度量评估阶段,考虑项目的规模和架构带来的影响,将项目中上帝类相关度量指标的平均值作为基准,设计实验确定比例因子,并以平均值和比例因子的乘积作为阈值,筛选得到上帝类的检测结果.在代码坏味标准数据集上的实验结果表明:与现有的上帝类检测方法相比,该方法在精确率和F1值上分别提升了25.82个百分点和33.39个百分点,同时保持了较高的召回率. God class refers to a class that carries heavy tasks and responsibilities.The common feature of God class is that it contains a large number of attributes and methods,and has multiple dependencies with other classes in the system.God class is a typical code smell,which has a negative impact on the development and maintenance of the software.In recent years,many studies have been devoted to discovering or refactoring the God class;however,the detection ability of existing methods is not strong,and the detection precision is not high enough.This study proposes a God class detection approach based on graph model and isolation forest algorithm,which can be divided into two stages:The stage of the graph structure information analysis and the stage of intra-class measurement evaluation.In the stage of the graph structure information analysis,inter-class method call graphs and intra-class structure graphs are established,respectively.The isolation forest algorithm is used to reduce the detection range of God class.In the stage of the intra-class measurement evaluation,the impact of the scale and architecture of the project is taken into account,and the average value of the God class related measurement indicators in the project is used as the benchmark.An experiment is designed to determine the scale factors,and the product of the average value and the scale factors are used as the threshold for the detection to obtain the God class detection result.The experimental results on the code smell benchmark data set show that the method proposed in this article improves the precision and F1 value by 25.8 percentage points and 33.39 percentage points,respectively,compared to an existing God class detection method,with a high recall at the same time.
作者 刘弋 吴毅坚 彭鑫 闫亚东 LIU Yi;WU Yi-Jian;PENG Xin;YAN Ya-Dong(Software School,Fudan University,Shanghai 200438,China;Shanghai Key Laboratory of Data Science(Fudan University),Shanghai 200438,China)
出处 《软件学报》 EI CSCD 北大核心 2022年第11期4046-4060,共15页 Journal of Software
基金 国家重点研发计划(2016YFB1000801)。
关键词 代码坏味 软件维护 上帝类 孤立森林 code smell software maintenance God class isolation forest
  • 相关文献

参考文献6

二级参考文献26

共引文献26

同被引文献10

引证文献1

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

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