As is typical, I’ve spent most of December catching up on tasks that I don’t have time for during the quarter when I’m teaching. Reading email is definitely one of those tasks, and some email came into my inbox this morning with a link to an interesting study.

Some neuroscientists at MIT did a study in which they asked (young) people who were familiar with two programming languages (Python and ScratchJr in particular) to read a program and predict what it would do. They had the subjects connected to an fMRI scanner and watched what areas of their brain activated during the task. They found that the task mainly activated the multiple demand network, which is “recruited for tasks that require holding many pieces of information in the mind at once”. I don’t think this is a surprising result for anyone who has tried to predict what an unknown program will do since predicting program behavior is complex and requires you to hold a lot of information in your head. This is my intuition as to why introductory programming instructors are always worried about the impact of cognitive load on students who are learning to program.

But the study is also interesting for what it didn’t find. The program prediction task didn’t activate the areas of the brain responsible for language. The article also notes that “… math and logic programs seem to rely mainly on the multiple demand regions in the left hemisphere, while tasks that involve spatial navigation activate the right hemisphere more than the left. The MIT team found that reading computer code appears to activate both the left and the right sides of the multiple demand network …”

The article concludes that program comprehension is its own unique type of task. One of the study authors is quoted as saying: “But it looks like computer science educators will have to develop their own approaches for teaching code most effectively.” To which I say, yes, we know and we’re working on it.