基于动态分析和引力公式的关键类识别
CSTR:
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

TP311

基金项目:

国家自然科学基金 (62272412, 62232008, 62032010); 浙江省自然科学基金 (LY22F020007); 桐乡市通用人工智能研究院项目(TAGI2-A-2024-0003); 浙江工商大学“数字+学科建设”项目(SZJ2022B015)


Key Class Identification Based on Dynamic Analysis and Gravitational Formula
Author:
Affiliation:

Fund Project:

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

    关键类是理解复杂软件的极佳起点, 不仅有助于优化软件的文档化过程, 也有助于压缩逆向工程得到的类图. 尽管目前已经提出了很多有效的关键类识别方法, 但普遍存在3点不足: 1)现有工作所依赖的软件网络(由软件元素及其依赖构建的图)不可避免地会包含软件运行时永远不会(或极少)被执行到的软件元素; 2)基于动态分析构建的软件网络往往不够完整, 会遗漏真正的关键类; 3)现有工作通常只考虑类之间的直接耦合对类重要性的影响, 而忽视类之间的间接(非接触)耦合及邻居节点度分布的多样性对类重要性的影响. 有鉴于此, 提出一种融合动态分析和引力公式的关键类识别方法. 首先, 使用静态分析技术构建面向对象软件的类依赖网络CCN (class coupling network), 以抽象类及类之间的耦合关系. 其次, 综合考虑CCN中类之间“直接和间接的耦合”“邻居节点度分布的多样性”等对类重要性的影响, 构建引力熵GEN (gravitational entropy)度量指标以量化类的重要性. 然后, 按照类的GEN值对所有类进行降序排列, 从而得到初步的排序结果. 最后, 通过动态分析技术收集运行时类之间真实的交互关系, 进而对初步排序的结果进行优化, 并通过设定阈值来过滤非关键类, 从而得到候选的关键类. 8个开源Java软件上的实验结果表明: 1) 在检查不超过前15% (或top-25)的节点时, 所提出的方法从整体上而言均显著优于其他11种对比方法; 2)使用动态分析对结果进行优化, 有助于显著提升所提出方法的性能; 3)耦合类型的不同赋权方式对所提出方法的性能没有显著影响; 4)所提出的方法在运行效率上是可以接受的.

    Abstract:

    Key classes are a crucial starting point for understanding complex software, contributing to the optimization of documentation and the compression of reverse-engineered class diagrams. Although many effective key class identification methods have been proposed, three major limitations remain: 1) software networks, which are graphs representing software elements and their dependencies, often include elements that are never or rarely executed at runtime; 2) networks constructed through dynamic analysis are frequently incomplete, potentially omitting truly key classes; and 3) most existing approaches consider only the effect of direct coupling between classes, while ignoring the influence of indirect (non-contact) coupling and the diversity of degree distribution among neighboring nodes. To address these issues, a key class identification approach is proposed that integrates dynamic analysis with a gravitational formula. First, a class coupling network (CCN) is constructed using static analysis to represent classes and their coupling relationships. Second, a gravitational entropy (GEN) metric is introduced to quantify class importance by jointly considering direct and indirect couplings in the CCN and the degree-distribution diversity of neighboring nodes. Third, classes are ranked in descending order based on their GEN values to obtain a preliminary ranking. Finally, dynamic analysis is performed to capture actual runtime interactions between classes, which are used to refine the preliminary results. A threshold is applied to filter out non-key classes, producing a final set of candidate key classes. Experimental results on eight open-source Java projects demonstrate that the proposed method significantly outperforms eleven baseline approaches when considering no more than the top 15% (or top 25) of nodes. The integration of dynamic analysis notably improves the performance of the proposed method. Moreover, the choice of weighting schemes for coupling types has a minimal impact on performance, and the overall computational efficiency is acceptable.

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

潘伟丰,杨燕微,杨子江,姜波,王家乐,杨柏林.基于动态分析和引力公式的关键类识别.软件学报,2026,37(5):2063-2084

复制
相关视频

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

京公网安备 11040202500063号