基于图模型和孤立森林的上帝类检测方法
作者:
作者单位:

作者简介:

刘弋(1997-),男,硕士生,主要研究领域为智能化软件开发;彭鑫(1979-),男,博士,教授,博士生导师,CCF杰出会员,主要研究领域为智能化软件开发,移动计算,云计算;吴毅坚(1979-),男,博士,副教授,CCF专业会员,主要研究领域为软件体系结构,软件复用和产品线,工业环境中的软件演化;闫亚东(1998-),男,硕士生,主要研究领域为智能化软件开发.

通讯作者:

吴毅坚,E-mail:wuyijian@fudan.edu.cn

中图分类号:

TP311

基金项目:

国家重点研发计划(2016YFB1000801)


God Class Detection Approach Based on Graph Model and Isolation Forest
Author:
Affiliation:

Fund Project:

National Key Research and Development Program of China (2016YFB1000801)

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    上帝类(God class)是指同时包含多种任务职责的类,其常见特征是包含大量的属性与方法,并且与系统中的其他类有多种依赖关系.上帝类是一种典型的代码坏味,对软件的开发维护产生负面影响.近年来,许多研究都致力于发现和重构上帝类,但是现有方法识别上帝类的能力不强,检测精确率不高.提出了一种基于图模型和孤立森林的上帝类检测方法,主要分为两个阶段:图结构信息分析阶段和类内度量评估阶段.在图结构信息分析阶段,建立类间的方法调用图和类内结构图,采用孤立森林算法缩小上帝类的检测范围;在类内度量评估阶段,考虑项目的规模和架构带来的影响,将项目中上帝类相关度量指标的平均值作为基准,设计实验确定比例因子,并以平均值和比例因子的乘积作为阈值,筛选得到上帝类的检测结果.在代码坏味标准数据集上的实验结果表明:与现有的上帝类检测方法相比,该方法在精确率和F1值上分别提升了25.82个百分点和33.39个百分点,同时保持了较高的召回率.

    Abstract:

    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.

    参考文献
    相似文献
    引证文献
引用本文

刘弋,吴毅坚,彭鑫,闫亚东.基于图模型和孤立森林的上帝类检测方法.软件学报,2022,33(11):4046-4060

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2020-11-19
  • 最后修改日期:2021-01-29
  • 录用日期:
  • 在线发布日期: 2021-05-21
  • 出版日期: 2022-11-06
文章二维码
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号