arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2203.09959cs.SE
收藏

程序员如何使用基本数据类型表达高级概念?

How Do Programmers Express High-Level Concepts using Primitive Data Types?

Yusuke Shinyama, Yoshitaka Arahori, Katsuhiko Gondow

摘要:

我们研究了程序员如何使用基本数据类型表达高级概念,如路径名和坐标。虽然过分依赖原始数据类型有时被批评为一种不好的气味,但它仍然是程序员的常见做法。我们提出了一种新的方法,通过检查API调用来准确地识别某些预定义概念的表达式。我们定义了Java标准API中使用的12种概念类型。然后,我们从26个开源项目中获得了每个概念类型的表达式。基于得到的表达式,我们训练了一个基于决策树的分类器。它实现了83%的F-分数正确预测的概念类型为一个给定的表达式。我们的结果表明,它是可能的推断概念类型从源代码相当不错,一旦足够的例子。所得到的分类器可用于潜在的错误检测,测试用例生成和文档。

英文摘要:

We investigated how programmers express high-level concepts such as path names and coordinates using primitive data types. While relying too much on primitive data types is sometimes criticized as a bad smell, it is still a common practice among programmers. We propose a novel way to accurately identify expressions for certain predefined concepts by examining API calls. We defined twelve conceptual types used in the Java Standard API. We then obtained expressions for each conceptual type from 26 open source projects. Based on the expressions obtained, we trained a decision tree-based classifier. It achieved 83% F-score for correctly predicting the conceptual type for a given expression. Our result indicates that it is possible to infer a conceptual type from a source code reasonably well once enough examples are given. The obtained classifier can be used for potential bug detection, test case generation and documentation.

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

↑