Skip to main content
Erschienen in: Empirical Software Engineering 3/2017

21.11.2016

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

verfasst von: Ahmad Jbara, Dror G. Feitelson

Erschienen in: Empirical Software Engineering | Ausgabe 3/2017

Einloggen

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

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.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Literatur
Zurück zum Zitat Bednarik R, Tukiainen M (2006) An eye-tracking methodology for characterizing program comprehension processes. In: Proceedings of the 2006 symposium on eye tracking research & applications. ISBN 1-59593-305-0. ACM, New York, pp 125–132, DOI 10.1145/1117309.1117356, (to appear in print) Bednarik R, Tukiainen M (2006) An eye-tracking methodology for characterizing program comprehension processes. In: Proceedings of the 2006 symposium on eye tracking research & applications. ISBN 1-59593-305-0. ACM, New York, pp 125–132, DOI 10.​1145/​1117309.​1117356, (to appear in print)
Zurück zum Zitat Brooks A, Daly J, Miller J, Roper M, Wood M (1994) Replication’s Role in Experimental Computer Science. Tech. Rep. EFoCS-5-94 [RR/94/172]. University of Strathclyde Brooks A, Daly J, Miller J, Roper M, Wood M (1994) Replication’s Role in Experimental Computer Science. Tech. Rep. EFoCS-5-94 [RR/94/172]. University of Strathclyde
Zurück zum Zitat Busjahn T, Schulte C, Busjahn A (2011) Analysis of code reading to gain more insight in program comprehension. In: Proceedings of the 11th Koli calling international conference on computing education research. ISBN 978-1-4503-1052-9, 10.1145/2094131.2094133. ACM, New York, pp 1–9 Busjahn T, Schulte C, Busjahn A (2011) Analysis of code reading to gain more insight in program comprehension. In: Proceedings of the 11th Koli calling international conference on computing education research. ISBN 978-1-4503-1052-9, 10.​1145/​2094131.​2094133. ACM, New York, pp 1–9
Zurück zum Zitat Cornelissen B, Zaidman A, van Deursen A (2011) A controlled experiment for program comprehension through trace visualization. IEEE Trans Softw Eng 37 (3):341–355. doi:10.1109/TSE.2010.47 CrossRef Cornelissen B, Zaidman A, van Deursen A (2011) A controlled experiment for program comprehension through trace visualization. IEEE Trans Softw Eng 37 (3):341–355. doi:10.​1109/​TSE.​2010.​47 CrossRef
Zurück zum Zitat Feitelson D G (2015) Using students as experimental subjects in software engineering research – a review and discussion of the evidence. arXiv:1512.08409[cs.SE] Feitelson D G (2015) Using students as experimental subjects in software engineering research – a review and discussion of the evidence. arXiv:1512.​08409[cs.SE]
Zurück zum Zitat Fenton N E, Pfleeger S L (1998) Software metrics: a rigorous and practical approach. Course technology, 2nd edn. Fenton N E, Pfleeger S L (1998) Software metrics: a rigorous and practical approach. Course technology, 2nd edn.
Zurück zum Zitat Fritz T, Begel A, Müller S C, Yigit-Elliott S, Züger M (2014) Using psycho-physiological measures to assess task difficulty in software development. In: Proceedings of the 36th international conference on software engineering. ISBN 978-1-4503-2756-5, 10.1145/2568225.2568266. ACM, New York, pp 402–413 Fritz T, Begel A, Müller S C, Yigit-Elliott S, Züger M (2014) Using psycho-physiological measures to assess task difficulty in software development. In: Proceedings of the 36th international conference on software engineering. ISBN 978-1-4503-2756-5, 10.​1145/​2568225.​2568266. ACM, New York, pp 402–413
Zurück zum Zitat Halstead M (1977) Elements of software science. Elsevier Science Inc. Halstead M (1977) Elements of software science. Elsevier Science Inc.
Zurück zum Zitat Holmqvist K, Nyström M, Andersson R, Dewhurst R, Jarodzka H, Van de Weijer J (2011) Eye tracking: a comprehensive guide to methods and measures. Oxford University Press Holmqvist K, Nyström M, Andersson R, Dewhurst R, Jarodzka H, Van de Weijer J (2011) Eye tracking: a comprehensive guide to methods and measures. Oxford University Press
Zurück zum Zitat Imazato A, Sasaki Y, Higo Y, Kusumoto S (2013) Improving process of source code modification focusing on repeated code. In: Heidrich J, Oivo M, Jedlitschka A, Baldassarre M (eds) Product-focused software process improvement. Lecture Notes in Computer Science. ISBN 978-3-642-39258-0, 10.1007/978-3-642-39259-7_24, vol 7983. Springer, Berlin Heidelberg, pp 298–312 Imazato A, Sasaki Y, Higo Y, Kusumoto S (2013) Improving process of source code modification focusing on repeated code. In: Heidrich J, Oivo M, Jedlitschka A, Baldassarre M (eds) Product-focused software process improvement. Lecture Notes in Computer Science. ISBN 978-3-642-39258-0, 10.​1007/​978-3-642-39259-7_​24, vol 7983. Springer, Berlin Heidelberg, pp 298–312
Zurück zum Zitat Jbara A, Feitelson D G (2014) Quantification of code regularity using preprocessing and compression. Manuscript Jbara A, Feitelson D G (2014) Quantification of code regularity using preprocessing and compression. Manuscript
Zurück zum Zitat Jbara A, Feitelson D G (2014a) On the effect of code regularity on comprehension. In: Proceedings of the 22nd international conference on program comprehension. ISBN 978-1-4503-2879-1, 10.1145/2597008.2597140. ACM, New York, pp 189–200 Jbara A, Feitelson D G (2014a) On the effect of code regularity on comprehension. In: Proceedings of the 22nd international conference on program comprehension. ISBN 978-1-4503-2879-1, 10.​1145/​2597008.​2597140. ACM, New York, pp 189–200
Zurück zum Zitat Jbara A, Feitelson D G (2014b) JCSD: visual support for understanding code control structure. In: Proceedings of the 22Nd international conference on program comprehension. ISBN 978-1-4503-2879-1, 10.1145/2597008.2597801. ACM, New York, pp 300–303 Jbara A, Feitelson D G (2014b) JCSD: visual support for understanding code control structure. In: Proceedings of the 22Nd international conference on program comprehension. ISBN 978-1-4503-2879-1, 10.​1145/​2597008.​2597801. ACM, New York, pp 300–303
Zurück zum Zitat Just M, Carpenter P (1980) A theory of reading: from eye fixations to comprehension. Psychol Rev 87:329–354CrossRef Just M, Carpenter P (1980) A theory of reading: from eye fixations to comprehension. Psychol Rev 87:329–354CrossRef
Zurück zum Zitat Krein J L, Pratt L, Swenson A, MacLean A, Knutson C D, Eggett D (2011) Design patterns in software maintenance: an experiment replication at Brigham Young University. In: 2nd Intl. workshop replication in empirical software engineering research. doi:10.1109/RESER.2011.10, pp 25–34 Krein J L, Pratt L, Swenson A, MacLean A, Knutson C D, Eggett D (2011) Design patterns in software maintenance: an experiment replication at Brigham Young University. In: 2nd Intl. workshop replication in empirical software engineering research. doi:10.​1109/​RESER.​2011.​10, pp 25–34
Zurück zum Zitat Mennie N, Hayhoe M, Sullivan B (2007) Look-ahead fixations: anticipatory eye movements in natural tasks. Exper Brain Res 179:427–442CrossRef Mennie N, Hayhoe M, Sullivan B (2007) Look-ahead fixations: anticipatory eye movements in natural tasks. Exper Brain Res 179:427–442CrossRef
Zurück zum Zitat Mondal M, Roy C K, Schneider K A (2015) A comparative study on the bug-proneness of different types of code clones. In: 2015 IEEE International conference on software maintenance and evolution (ICSME), pp 91–100. doi:10.1109/ICSM.2015.7332455 Mondal M, Roy C K, Schneider K A (2015) A comparative study on the bug-proneness of different types of code clones. In: 2015 IEEE International conference on software maintenance and evolution (ICSME), pp 91–100. doi:10.​1109/​ICSM.​2015.​7332455
Zurück zum Zitat Murray W S, Kennedy A (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+CrossRef Murray W S, Kennedy A (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+CrossRef
Zurück zum Zitat Pelz J B, Canosa R, Babcock J, Barber J (2001) Visual perception in familiar, complex tasks. In: Proceedings of the 2001 international conference on image processing, pp 12–15 Pelz J B, Canosa R, Babcock J, Barber J (2001) Visual perception in familiar, complex tasks. In: Proceedings of the 2001 international conference on image processing, pp 12–15
Zurück zum Zitat Rayner K, Fischer M H (1996) Mindless reading revisited: eye movements during reading and scanning are different. Percept Psychophys 58(5):734–747. doi:10.3758/BF03213106 CrossRef Rayner K, Fischer M H (1996) Mindless reading revisited: eye movements during reading and scanning are different. Percept Psychophys 58(5):734–747. doi:10.​3758/​BF03213106 CrossRef
Zurück zum Zitat Renshaw J A, Finlay J E, Tyfa D, Ward R D (2004) Regressions re-visited: a new definition for the visual display paradigm. In: CHI ’04 Extended abstracts on human factors in computing systems. doi:10.1145/985921.986084. ACM, New York, pp 1437–1440 Renshaw J A, Finlay J E, Tyfa D, Ward R D (2004) Regressions re-visited: a new definition for the visual display paradigm. In: CHI ’04 Extended abstracts on human factors in computing systems. doi:10.​1145/​985921.​986084. ACM, New York, pp 1437–1440
Zurück zum Zitat Rodeghero P, McMillan C, McBurney P W, Bosch N, D’Mello S (2014) Improving automated source code summarization via an eye-tracking stud y of programmers. In: Proceedings of the 36th international conference on software engineering. ISBN 978-1-4503-2756-5, 10.1145/2568225.2568247. ACM, New York, pp 390–401 Rodeghero P, McMillan C, McBurney P W, Bosch N, D’Mello S (2014) Improving automated source code summarization via an eye-tracking stud y of programmers. In: Proceedings of the 36th international conference on software engineering. ISBN 978-1-4503-2756-5, 10.​1145/​2568225.​2568247. ACM, New York, pp 390–401
Zurück zum Zitat Rodeghero P, McMillan C (2015) An empirical study on the patterns of eye movement during summarization tasks. In: 2015 ACM/IEEE International symposium on empirical software engineering and measurement (ESEM), pp 1–10. doi:10.1109/ESEM.2015.7321188 Rodeghero P, McMillan C (2015) An empirical study on the patterns of eye movement during summarization tasks. In: 2015 ACM/IEEE International symposium on empirical software engineering and measurement (ESEM), pp 1–10. doi:10.​1109/​ESEM.​2015.​7321188
Zurück zum Zitat Sasaki Y, Ishihara T, Hotta K, Hata H, Higo Y, Igaki H, Kusumoto S (2012) Preprocessing of metrics measurement based on simplifying program structures. In: 19th Asia-Pacific software engineering conference (APSEC), vol 2, pp 120–127. doi:10.1109/APSEC.2012.59 Sasaki Y, Ishihara T, Hotta K, Hata H, Higo Y, Igaki H, Kusumoto S (2012) Preprocessing of metrics measurement based on simplifying program structures. In: 19th Asia-Pacific software engineering conference (APSEC), vol 2, pp 120–127. doi:10.​1109/​APSEC.​2012.​59
Zurück zum Zitat Schneider T D, Stephens R M (1990) Sequence logos: a new way to display consensus sequences. Nucleic Acids Res 18 Schneider T D, Stephens R M (1990) Sequence logos: a new way to display consensus sequences. Nucleic Acids Res 18
Zurück zum Zitat Sharif B, Falcone M, Maletic J I (2012) An eye-tracking study on the role of scan time in finding source code defects. In: Proceedings of the symposium on eye tracking research and applications. ISBN 978-1-4503-1221-9, 10.1145/2168556.2168642. ACM, New York, pp 381–384 Sharif B, Falcone M, Maletic J I (2012) An eye-tracking study on the role of scan time in finding source code defects. In: Proceedings of the symposium on eye tracking research and applications. ISBN 978-1-4503-1221-9, 10.​1145/​2168556.​2168642. ACM, New York, pp 381–384
Zurück zum Zitat Sharif B, Maletic J (2010a) An eye tracking study on camelCase and under_score identifier styles. In: IEEE 18th International conference on program comprehension (ICPC), pp 196–205. doi:10.1109/ICPC.2010.41 Sharif B, Maletic J (2010a) An eye tracking study on camelCase and under_score identifier styles. In: IEEE 18th International conference on program comprehension (ICPC), pp 196–205. doi:10.​1109/​ICPC.​2010.​41
Zurück zum Zitat Sharif B, Maletic J (2010b) An eye tracking study on the effects of layout in understanding the role of design patterns. In: IEEE International conference on software maintenance (ICSM), pp 1–10. doi:10.1109/ICSM.2010.5609582 Sharif B, Maletic J (2010b) An eye tracking study on the effects of layout in understanding the role of design patterns. In: IEEE International conference on software maintenance (ICSM), pp 1–10. doi:10.​1109/​ICSM.​2010.​5609582
Zurück zum Zitat Shneiderman B (1977) Measuring computer program quality and comprehension. Intl J Man-Mach Stud 9(4) Shneiderman B (1977) Measuring computer program quality and comprehension. Intl J Man-Mach Stud 9(4)
Zurück zum Zitat Siegmund J, Kästner C, Apel S, Parnin C, Bethmann A, Leich T, Saake G, Brechmann A (2014) Understanding understanding source code with functional magnetic resonance imaging. In: Proceedings of the 36th international conference on software engineering. ISBN 978-1-4503-2756-5, 10.1145/2568225.2568252. ACM, New York, pp 378–389 Siegmund J, Kästner C, Apel S, Parnin C, Bethmann A, Leich T, Saake G, Brechmann A (2014) Understanding understanding source code with functional magnetic resonance imaging. In: Proceedings of the 36th international conference on software engineering. ISBN 978-1-4503-2756-5, 10.​1145/​2568225.​2568252. ACM, New York, pp 378–389
Zurück zum Zitat Uwano H, Nakamura M, Monden A, Matsumoto K-i (2006) Analyzing individual performance of source code review using reviewers’ eye movement. In: Proceedings of the 2006 symposium on eye tracking research & applications. ISBN 1-59593-305-0, 10.1145/1117309.1117357. ACM, New York, pp 133–140 Uwano H, Nakamura M, Monden A, Matsumoto K-i (2006) Analyzing individual performance of source code review using reviewers’ eye movement. In: Proceedings of the 2006 symposium on eye tracking research & applications. ISBN 1-59593-305-0, 10.1145/1117309.1117357. ACM, New York, pp 133–140
Zurück zum Zitat Vinju J J, Godfrey M W (2012) What does control flow really look like? Eyeballing the cyclomatic complexity metric. In: 12th Working conf. source code analysis and manipulation Vinju J J, Godfrey M W (2012) What does control flow really look like? Eyeballing the cyclomatic complexity metric. In: 12th Working conf. source code analysis and manipulation
Zurück zum Zitat Wang H, Chignell M, Ishizuka M (2006) Empathic tutoring software agents using real-time eye tracking. In: Proceedings of the 2006 symposium on eye tracking research & applications. ISBN 1-59593-305-0, 10.1145/1117309.1117346. ACM, New York, pp 73–78 Wang H, Chignell M, Ishizuka M (2006) Empathic tutoring software agents using real-time eye tracking. In: Proceedings of the 2006 symposium on eye tracking research & applications. ISBN 1-59593-305-0, 10.​1145/​1117309.​1117346. ACM, New York, pp 73–78
Zurück zum Zitat Yusuf S, Kagdi H, Maletic J (2007) Assessing the comprehension of UML class diagrams via eye tracking. In: 15th IEEE International conference on program comprehension, pp 113–122. doi:10.1109/ICPC.2007.10 Yusuf S, Kagdi H, Maletic J (2007) Assessing the comprehension of UML class diagrams via eye tracking. In: 15th IEEE International conference on program comprehension, pp 113–122. doi:10.​1109/​ICPC.​2007.​10
Metadaten
Titel
How programmers read regular code: a controlled experiment using eye tracking
verfasst von
Ahmad Jbara
Dror G. Feitelson
Publikationsdatum
21.11.2016
Verlag
Springer US
Erschienen in
Empirical Software Engineering / Ausgabe 3/2017
Print ISSN: 1382-3256
Elektronische ISSN: 1573-7616
DOI
https://doi.org/10.1007/s10664-016-9477-x

Weitere Artikel der Ausgabe 3/2017

Empirical Software Engineering 3/2017 Zur Ausgabe