Functional programming (FP) promotes immutability and declarative thinking, offering benefits for reliability, maintainability, and scalability. Despite these advantages, FP remains less widely adopted than imperative programming (IP) languages such as C++. Prior studies have explored this gap by analyzing programmers’ self-reported experiences and performance, but cognitive-level insights for novices are limited. To address this, we conducted an eye-tracking study with 49 novice programmers to compare how they comprehend FP (Racket) and IP (C++) during tasks. We designed six paired tasks that covered similar concepts in both languages and employed a mixed-methods approach, including interviews and surveys, to understand their learning experiences. Participants showed fewer fixations and shorter per-element fixation times in Racket than in C++, yet they also frequently revisited parts of the FP code. This combination of lower per-element measures and higher regression rates suggests different cognitive processing patterns in Racket rather than lower effort. Prior C++ experience did not aid in understanding Racket, but gender differences emerged: women spent more time on Racket without improved outcomes. Participants reported lower satisfaction with FP, citing limited exposure, lack of support, and unclear real-world relevance. Our findings offer insights to inform tools, pedagogy, and strategies for making Racket and related FP instruction more approachable in similar educational settings.
Fang et al. (Wed,) studied this question.