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

How Do Programmers Express High-Level Concepts using Primitive Data Types?
复制标题

DOI:
10.1109/apsec53868.2021.00043
复制
发表时间:
2021-12
期刊:
2021 28th Asia-Pacific Software Engineering Conference (APSEC)
影响因子:
--
通讯作者:
Yusuke Shinyama;Yoshitaka Arahori;K. Gondow
Yusuke Shinyama;Yoshitaka Arahori;K. Gondow
中科院分区:
其他
文献类型:
--
作者:
Yusuke Shinyama;Yoshitaka Arahori;K. 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.