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

Java中的混乱原子

Atoms of Confusion in Java

Chris Langhout, Maurício Aniche

摘要:

虽然编写代码有时看起来微不足道,但当人们误解代码的实际功能时,问题就会出现。其中一个潜在的原因是“混乱的原子”,即最小可能的可误解源代码模式。以前的研究已经调查了C代码中混乱原子的影响。结果表明,开发人员在存在原子的代码中犯的错误明显更多。在本文中,我们将Gopstein等人的工作复制到Java语言中。在为Java推导出一组混乱原子之后,我们对132名计算机科学学生进行了一个两阶段的实验(即,新手开发者)。我们的研究结果表明,受14个混淆原子中的7个影响的代码片段中,参与者犯错误的可能性是2.7到56倍,当面对两个版本的代码片段时,参与者认为受混淆原子影响的版本在14个混淆原子中的10个中更令人困惑和/或可读性更低。

英文摘要:

Although writing code seems trivial at times, problems arise when humans misinterpret what the code actually does. One of the potential causes are "atoms of confusion", the smallest possible patterns of misinterpretable source code. Previous research has investigated the impact of atoms of confusion in C code. Results show that developers make significantly more mistakes in code where atoms are present. In this paper, we replicate the work of Gopstein et al. to the Java language. After deriving a set of atoms of confusion for Java, we perform a two-phase experiment with 132 computer science students (i.e., novice developers). Our results show that participants are 2.7 up to 56 times more likely to make mistakes in code snippets affected by 7 out of the 14 studied atoms of confusion, and when faced with both versions of the code snippets, participants perceived the version affected by the atom of confusion to be more confusing and/or less readable in 10 out of the 14 studied atoms of confusion.

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

↑