arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2203.08787cs.SEcs.AI
收藏

探索用于提取类重构推荐的变分图自动编码器

Exploring Variational Graph Auto-Encoders for Extract Class Refactoring Recommendation

University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)

Pritom Saha Akash, Kevin Chen-Chuan Chang

摘要:

代码气味是软件系统中设计和开发缺陷的标志,它会降低系统的可重用性和可维护性。重构是一种持续的实践,以消除程序代码中的代码气味。在不同的代码气味中,God类或Blob是最常见的代码气味之一。一个god类包含太多的责任,违反了面向对象编程设计的低耦合和高内聚原则。本文提出了一种自动的方法来提取一个上帝类到多个更小的类更具体的责任。为此,我们首先为相关的god类构建一个方法图(作为节点)。任何两种方法之间的边缘由它们的结构相似性确定,并且使用不同的语义表示方法初始化每个方法的特征。然后,使用变分图自动编码器来学习每种方法的向量表示。最后,学习的向量用于将方法聚类到不同的组中,以推荐为重构类。我们使用三种不同的类内聚度量对从两个著名的开源系统中收集的16个实际的上帝类进行了评估。我们还对我们的方法与类似的现有方法进行了比较研究,发现所提出的方法对实验中使用的几乎所有上帝类都产生了更好的结果。

英文摘要:

The code smell is a sign of design and development flaws in a software system that reduces the reusability and maintainability of the system. Refactoring is done as an ongoing practice to remove the code smell from the program code. Among different code smells, the God class or Blob is one of the most common code smells. A god class contains too many responsibilities, violating object-oriented programming design's low coupling and high cohesiveness principles. This paper proposes an automatic approach to extracting a God class into multiple smaller classes with more specific responsibilities. To do this, we first construct a graph of methods (as nodes) for the concerning god class. The edge between any two methods is determined by their structural similarity, and the feature for each method is initialized using different semantic representation methods. Then, the variational graph auto-encoder is used to learn a vector representation for each method. Finally, the learned vectors are used to cluster methods into different groups to be recommended as refactored classes. We assessed the proposed framework using three different class cohesion metrics on sixteen actual God Classes collected from two well-known open-source systems. We also conducted a comparative study of our approach with a similar existing approach and found that the proposed approach generated better results for almost all the God Classes used in the experiment.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑