arrow
返回

An eye tracking study assessing source code readability rules for program comprehension

delete2024-10-05
delete0
PRE
AI
K
Kang-il Park
J
Jack Johnson
C
Cole S. Peterson
N
Nishitha Yedla
I
Isaac Baysinger
J
Jairo Aponte
B
Bonita Sharif *
DOI:10.1007/s10664-024-10532-xdelete
delete原文链接
delete分享
delete收藏
摘要

摘要

En 中文
ContextWhile developing software, developers must first read and understand source code in order to work on change requests such as bug fixes or feature additions. The easier it is for them to understand what the code does, the faster they can get to working on change tasks. Source code is meant to be consumed by humans, and hence, the human factor of how readable the code is plays an important role. During the past decade, software engineering researchers have used eye trackers to see how developers comprehend code. The eye tracker enables us to see exactly what parts of the code the developer is reading (and for how long) in an objective manner without prompting them.ObjectiveIn this paper, we leverage eye tracking technology to replicate a prior online questionnaire-based controlled experiment (Johnson et al. 2019) to determine the visual effort needed to read code presented in different readability rule styles. As in the prior study, we assess two readability rules - minimize nesting and avoid do-while loops. Each rule is evaluated on code snippets that are correct and incorrect with respect to a requirement.MethodThis study was conducted in a lab setting with the Tobii X-60 eye tracker where each of the 46 participants. 21 undergraduate students, 24 graduate students, and 6 professional developers (part-time or full-time)) participated and were given eight Java methods from a total set of 32 Java methods in four categories: ones that follow/do not follow the readability rule and that are correct/incorrect. After reading each code snippet, they were asked to answer a multiple-choice comprehension question about the code and some questions related to logical correctness and confidence. In addition to comparing the time and accuracy of answering the questions with the prior study, we also report on the visual effort of completing the tasks via gaze-based metrics.ResultsThe results of this study concur with the online study, in that following the minimize nesting rule showed higher confidence (14.8%) decreased time spent reading programming tasks (7.1%), and decreased accuracy in finding bugs (5.4%). However, the decrease in accuracy was not significant. For method analysis tasks showing one Java method at a time, participants spent proportionally less time fixating on code lines (9.9%) and had fewer fixations on code lines (3. 5%) when a snippet is not following the minimize-nesting rule. However, the opposite is true when the snippet is logically incorrect (3.4% and 3.9%, respectively), regardless of whether the rule was followed. The avoid do-while rule, however, did not have as significant of an effect. Following the avoid do-while rule did result in higher accuracy in task performance albeit with lower fixation counts. We also note a lower rate for a majority of the gaze-based linearity metrics on the rule-breaking code snippet when the rule-following and rule-breaking code snippets are displayed side-by-side.ConclusionsThe results of this study show strong support for the use of the minimize nesting rule. All participants considered the minimize nesting rule to be important and considered the avoid do-while rule to be less important. This was despite the results showing that the participants were more accurate when the avoid do-while rule was followed. Overall, participants ranked the snippets following the readability rules to be higher than the snippets that do not follow the rules. We discuss the implications of these results for advancing the state of the art for reducing visual effort and cognitive load in code readability research.
Keyword:
Eye tracking
Source code readability rules
Program comprehension
Correctness
Controlled experiment
An Eye-Tracking Study of Java Programmers and Application to Source Code Summarization
err2015-11-01
err47
PREAI
errRodeghero, Paige; Liu, Cheng; McBurney, Paul W.; McMillan, Collin
err分享
err收藏
err分享
err收藏
How do annotations affect Java code readability?注释如何影响Java代码的可读性?
err2024-05-03
err0
PREAI
errGuerra, Eduardo; Gomes, Everaldo; Ferreira, Jeferson; Wiese, Igor; Lima, Phyllipe; Gerosa, Marco; Meirelles, Paulo
err分享
err收藏

期刊

Empirical Software Engineering 封面图
Empirical Software Engineering
IF:
3.6
论文数:
2.0K
被引数:
6.4K

机构

University of Nebraska System 封面图
University of Nebraska System
学者数:
2.7W
论文数: 2.3W
被引数: 2.8W
U
University of Minnesota Twin Cities
学者数:
260
论文数: 154
被引数: 2.5W
U
university of nebraska lincoln
学者数:
63
论文数: 38
被引数: 5.7K
学者 查看更多机构
引用论文

引用论文

err分享
err收藏
The impact of identifier style on effort and comprehension标识符风格对努力和理解的影响
err2012-05-03
err113
PREAI
errBinkley, Dave; Davis, Marcia; Lawrie, Dawn; Maletic, Jonathan I.; Morrell, Christopher; Sharif, Bonita
err分享
err收藏
Search for seismic discontinuities in the lower mantle
err2001-09-01
err0
errOAAI
errLev Vinnik; Mamoru Kato; Hitoshi Kawakatsu
err分享
err收藏
Measuring Program Comprehension: A Large-Scale Field Study with Professionals
err2018-10-01
err195
errOAAI
errXia, Xin; Bao, Lingfeng; Lo, David; Xing, Zhenchang; Hassan, Ahmed E.; Li, Shanping
err分享
err收藏
The Hybrid Coronary Approach for Optimal Revascularization
err2020-07-01
err0
errOAAI
errPedro R. Moreno; Gregg W. Stone; Carlos A. Gonzalez-Lengua; John D. Puskas
err分享
err收藏
MODALITIES OF SEIZURE ONSET IN TEMPORAL LOBE EPILEPSY
err1996-09-01
err0
PREAI
errF. Arruda; L. F. Quesney; R. Wennberg; A. Olivier
err分享
err收藏
学者 查看更多内容