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

作者简介:

通讯作者:

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

基金项目:

国家重点研发计划(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 paper 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, the inter-class method call graph and the intra-class structure graph are established respectively, and 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. We design an experiment to determine the scale factors, and use the product of the average value and the scale factors as the threshold for the detection to obetain the god class detection result. The experimental results on the code smell standard data set show that the method proposed in this article improves the precision and F1 value by 25.82% and 33.39% respectively compared with the existing god class detection methods, while maintaining a high level of recall at the same time.

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

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

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

京公网安备 11040202500063号