Abstract:
Background: There have been many studies on the teaching and learning of programming styles, including recursion and iteration. Programming styles have been studied from the point of view of mental and conceptual models, program comprehension, common misconceptions, and how to teach them effectively. Recent studies suggest that students tend to understand iterative programs more efficiently than recursive programs. However, there is little empirical evidence as to why this might be the case.
Objective: To create better teaching practices for students, we first have to understand how students understand recursion and iteration. We aim to investigate this phenomenon and identify factors that might drive the understanding of iterative and recursive programs by students.
Method: We conducted a remote eye-tracking study to record students’ visual attention as they were comprehending simple iterative and recursive programs. A total of 117 students participated in the study, and we collected behavioral and visual-attention data.
Results: We found no clear indication that programming style affects how well and fast students understand iterative and recursive programs. Regarding visual attention, we observed that students follow a comparable reading behavior for both iterative and recursive programs. However, we found different reading behaviors when comparing students who correctly understood programs with students who did not.
Conclusion: It can be said that for students, there is no difference in efficiency in understanding iterative and recursive algorithms. The visual attention of that same group is equally indistinguishable between top-down and bottom-up comprehension. But it seems that the different programming styles have a different approach to understanding the source code, so other beacons in the code become more relevant and these are visited more often in the course of the comprehension process.
Future Work: To derive more general conclusions, further studies are necessary, for example, with more advanced code (e.g., with mutual recursion) or letting students write code themselves. Measuring the cognitive load (e.g., with pupil dilation) could also provide more rigorous insights into the underlying cognitive process of program comprehension.
PPIG 2021 - 32nd Annual Workshop
Understanding Comprehension of Iterative and Recursive Programs with Remote Eye Tracking