语义丰富上下文模型对软件模块化的影响
On the Effect of Semantically Enriched Context Models on Software Modularization
摘要:
许多现有的程序理解方法依赖于源代码中的语言信息,如标识符名称和注释。语义聚类就是这样一种系统模块化的技术,它依赖于程序的非正式语义,编码在源代码中使用的词汇表中。将源代码视为标记的集合会丢失标识符中嵌入的语义信息。我们试图克服这个问题,通过引入上下文模型的源代码标识符,以获得一个语义内核,它可以用于派生的主题,通过系统以及它们的聚类。在第一个模型中,我们将标识符抽象为其类型表示,并基于上下文的概念构建源代码的上下文向量表示。上下文的第二个概念是基于标识符之间的数据流来定义的,以将模块表示为依赖关系图,其中节点对应于标识符,而边表示标识符对之间的数据依赖关系。我们已经将我们的方法应用于10个中型开源Java项目,并表明通过引入上下文标识符,软件系统的模块化质量得到提高。这两个上下文模型给出的结果优于普通的矢量表示的文档。在某些情况下,分解的权威性提高了67%。此外,我们的方法JEdit,一个开源的编辑器,更详细的评估表明,推断的主题,通过执行主题分析的上下文表示是更有意义的相比,纯表示的文件。所提出的方法,在引入一个上下文模型的源代码标识符铺平了道路,建设工具,支持开发人员在程序理解任务,如应用程序和领域概念的位置,软件模块化和主题分析。
英文摘要:
Many of the existing approaches for program comprehension rely on the linguistic information found in source code, such as identifier names and comments. Semantic clustering is one such technique for modularization of the system that relies on the informal semantics of the program, encoded in the vocabulary used in the source code. Treating the source code as a collection of tokens loses the semantic information embedded within the identifiers. We try to overcome this problem by introducing context models for source code identifiers to obtain a semantic kernel, which can be used for both deriving the topics that run through the system as well as their clustering. In the first model, we abstract an identifier to its type representation and build on this notion of context to construct contextual vector representation of the source code. The second notion of context is defined based on the flow of data between identifiers to represent a module as a dependency graph where the nodes correspond to identifiers and the edges represent the data dependencies between pairs of identifiers. We have applied our approach to 10 medium-sized open source Java projects, and show that by introducing contexts for identifiers, the quality of the modularization of the software systems is improved. Both of the context models give results that are superior to the plain vector representation of documents. In some cases, the authoritativeness of decompositions is improved by 67%. Furthermore, a more detailed evaluation of our approach on JEdit, an open source editor, demonstrates that inferred topics through performing topic analysis on the contextual representations are more meaningful compared to the plain representation of the documents. The proposed approach in introducing a context model for source code identifiers paves the way for building tools that support developers in program comprehension tasks such as application and domain concept location, software modularization and topic analysis.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。