Modeling How Programmers Read Code
code-comprehensioneye-trackingprogramming-languagescognitive-science
Abstraction: Eye-tracking study of expert vs novice programmer code reading
Key points:
- Eye-tracking experiments (Tobii TX300 at 300 Hz) measured gaze during prediction of Python program output across programmers of different experience levels.
- Expert programmers (e.g., Eric Holk) show directed, precise eye movements from the start; novices scan the whole program first before tackling details.
- Experts appear to "compile" functions mentally — on second encounter, no lengthy re-reading of a definition is needed.
- Novices show a sharp transition in reading style once a pattern is recognized, then focus only on relevant data.
- Parafoveal vision and the gap between foveal fixation and visual attention complicate interpretation of eye-tracking data.
- Long-term goal: build an executable computational cognitive model (ACT-R style) that can "read" code, replacing structural metrics like cyclomatic complexity with cognitively grounded ones.
Connections: Code Comprehension · Eye Tracking · Programming Language Design · Cognitive Modeling
Source: http://synesthesiam.com/posts/modeling-how-programmers-read-code.html