An Eye Tracking Perspective on How Developers Rate Source Code Readability Rules

https://doi.org/10.1109/SEmotion52567.2021.00009

Abstract:

Writing readable source code is generally considered good practice because it reduces comprehension time for both the original developer and others that have to read and maintain it. We conducted a code readability rating study using eye tracking equipment as part of a larger project where we compared pairs of Java methods side by side. The methods were written such that one followed a readability rule and the other did not.
The participants were tasked with rating which method they considered to be more readable. An explanation of the rating was also optionally provided. Eye tracking data was collected and analyzed during the rating process. We found that developers rated the snippet in the pair of methods that avoided nested if statements as more readable on average. There was no clear preference in the use of do-while statements. In addition, more developer fixation attention was on the snippet that avoided do-while loops and the snippet pairs relating to nested if statements had more equal fixation attention across the snippets.