通过多视图图聚类分解上帝头文件
Decomposing God Header File via Multi-View Graph Clustering
AI总结:
本文提出基于多视图图聚类的上帝头文件分解方法,构建并粗化代码元素图,识别聚类并解决循环依赖,准确率提升11.5%,减少15%-60%重新编译时间。
摘要:
上帝头文件与上帝类一样,对代码理解和维护构成了重大挑战。此外,它们还增加了代码重新编译所需的时间。然而,现有的针对上帝类的重构方法并不适用于处理上帝头文件,因为头文件中的代码元素大多是短声明类型,并且应考虑整个系统的构建依赖关系,以提高编译效率。同时,在上帝头文件分解中,确保分解后的子头文件之间无循环依赖也至关重要。本文提出了一种基于多视图图聚类的上帝头文件分解方法。该方法首先构建并粗化代码元素图,然后应用一种新颖的多视图图聚类算法来识别聚类,并引入一种启发式算法来解决聚类结果中的循环依赖问题。为了评估我们的方法,我们构建了一个合成数据集和一个真实世界的上帝头文件数据集。结果表明:1)我们的方法比现有的上帝类重构方法准确率高出11.5%;2)我们的分解结果在真实世界的上帝头文件上获得了更好的架构,表现为更高的模块化程度和无循环依赖;3)对于需要重新编译的历史提交,我们可以将重新编译时间减少15%至60%。
英文摘要:
God Header Files, just like God Classes, pose significant challenges for code comprehension and maintenance. Additionally, they increase the time required for code recompilation. However, existing refactoring methods for God Classes are inappropriate to deal with God Header Files because the code elements in header files are mostly short declaration types, and build dependencies of the entire system should be considered with the aim of improving compilation efficiency. Meanwhile, ensuring acyclic dependencies among the decomposed sub-header files is also crucial in the God Header File decomposition. This paper proposes a multi-view graph clustering based approach for decomposing God Header Files. It first constructs and coarsens the code element graph, then a novel multi-view graph clustering algorithm is applied to identify the clusters and a heuristic algorithm is introduced to address the cyclic dependencies in the clustering results. To evaluate our approach, we built both a synthetic dataset and a real-world God Header Files dataset. The results show that 1) Our approach could achieve 11.5% higher accuracy than existing God Class refactoring methods; 2) Our decomposition results attain better architecture on real-world God Header Files, evidenced by higher modularity and acyclic dependencies; 3) We can reduce 15% to 60% recompilation time for historical commits that require recompiling.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。