Investigating the Perception and Effects of Misunderstandings in Java Code

More Info
expand_more

Abstract

Although writing code seems trivial at times, problems arise when humans misinterpret what source code actually does. One of the potential causes are “atoms of confusion”; the smallest possible patterns of misinterpretable source code. The misunderstandings and errors have been studied in past for the C programming language. They are found to occur in many large projects and style guides. In this work, the existing tested set of atoms of confusion has been translated to Java. With this new set, our aim was to find out what atoms of confusion hinder the comprehensibility of Java programs. Additionally, we wanted to find out how these confusion patterns are perceived. To this end, the new code snippets are used in a two­fold experiment. The first part of the experiment asked the participant to write down the output of a code snippet. The results of this showed us that 7 out of the 14 translatable atoms are the cause of misunderstandings for students. We measured a significant increase in mistakes caused by the atoms of confusion. In the second part of the experiment we asked the participants to compare two code snippets on how confusing they are. One code snippet included the confusing pattern, while in the other, the pattern is avoided. Results showed us that these students also perceive the atoms of confusion as being more difficult to understand. The combined results show us the significance of these atoms of confusion, and show us examples of situations where we cannot assume programmers to simply grasp the meaning of what we write down as code. The code snippets for the experiment, scripts, and data used for this experiment are provided in an online appendix.

Files