This study attempts to explore cognition during program comprehension through physiological evidence by recording and comparing electroencephalogram (EEG) activities in different frequency bands and the eye movements of the participants with high or low programming abilities. An experiment was conducted with thirty-three undergraduate students majoring in Computer Science. We recorded their EEG activities when they were reading two programs with three types of program constructs. At the same time, the participants' eye movements were recorded by an eye tracker to further understand the relationship between the program comprehension process and EEG activities. Experimental results show that the high-performance participants displayed higher performance for working memory (theta power), attention resource allocation (lower alpha power), and interaction between working memory and semantic memory (upper alpha power) in program comprehension tasks of complex constructs, which proves related theories proposed in the existing research on programming and cognition. The results of this study not only offer objective evidence of the roles cognition plays in program comprehension but also provide educators with suggestions for designing suitable pedagogical strategies.
ASJC Scopus subject areas