How programmers read regular code: a controlled experiment using eye tracking

被引:0
作者
Ahmad Jbara
Dror G. Feitelson
机构
[1] Hebrew University,School of Computer Science and Engineering
[2] Netanya Academic College,School of Mathematics and Computer Science
来源
Empirical Software Engineering | 2017年 / 22卷
关键词
Eye-tracking; Controlled experiment; Code regularity; Software complexity;
D O I
暂无
中图分类号
学科分类号
摘要
Regular code, which includes repetitions of the same basic pattern, has been shown to have an effect on code comprehension: a regular function can be just as easy to comprehend as a non-regular one with the same functionality, despite being significantly longer and including more control constructs. It has been speculated that this effect is due to leveraging the understanding of the first instances to ease the understanding of repeated instances of the pattern. To verify and quantify this effect, we use eye tracking to measure the time and effort spent reading and understanding regular code. The experimental subjects were 18 students and 2 faculty members. The results are that time and effort invested in the initial code segments are indeed much larger than those spent on the later ones, and the decay in effort can be modeled by an exponential model. This shows that syntactic code complexity metrics (such as LOC and MCC) need to be made context-sensitive, e.g. by giving reduced weight to repeated segments according to their place in the sequence. However, it is not the case that repeated code segments are actually read more and more quickly. Rather, initial code segments receive more focus and are looked at more times, while later ones may be only skimmed. Further, a few recurring reading patterns have been identified, which together indicate that in general code reading is far from being purely linear, and exhibits significant variability across experimental subjects.
引用
收藏
页码:1440 / 1477
页数:37
相关论文
共 26 条
[1]  
Cornelissen B(2011)A controlled experiment for program comprehension through trace visualization IEEE Trans Softw Eng 37 341-355
[2]  
Zaidman A(1990)How do we read algorithms? A case study Computer 23 25-35
[3]  
van Deursen A(2000)Refixation frequency and memory mechanisms in visual search Current Biol 10 1209-1212
[4]  
Crosby M(1999)Computer interface evaluation using eye movements: methods and constructs Int J Indus Ergonom 24 631-645
[5]  
Stelovsky J(1980)A theory of reading: from eye fixations to comprehension Psychol Rev 87 329-354
[6]  
Gilchrist ID(1976)A complexity measure IEEE Trans Softw Eng 2 308-320
[7]  
Harvey M(2007)Look-ahead fixations: anticipatory eye movements in natural tasks Exper Brain Res 179 427-442
[8]  
Goldberg JH(1988)Spatial coding in the processing of anaphor by good and poor readers: evidence from eye movement analyses Q J Exper Psychol: Human Exper Psychol 40 693-718+
[9]  
Kotval XP(1994)Construction and testing of polynomials predicting software maintainability J Syst Softw 24 251-266
[10]  
Just M(1996)Mindless reading revisited: eye movements during reading and scanning are different Percept Psychophys 58 734-747