Skip to main content

Verified by Psychology Today


Do Math Geeks or Linguists Make for Better Programmers?

MIT and Tufts study reveals how brain handles computer code comprehension.

Source: Geralt/Pixabay

Are certain brains better suited for computer programming, such as “mathletes” or the polyglot extraordinaire who is flawlessly fluent in five languages? A new neuroscience study published earlier this month in eLife provides new insights that scientifically weigh in this ongoing debate.

Researcher Anna Ivanova from Massachusetts Institute of Technology (MIT) Department of Brain and Cognitive Sciences and McGovern Institute for Brain Research is the lead author of the study in collaboration with senior author Evelina Fedorenko. Other members of the research team include MIT’s Yotaro Sueoka, Hope H. Kean, and Shashank Srikant and Una-May O’Reilly at MIT Computer Science and Artificial Intelligence Laboratory (CSAIL), along with Riva Dhamala and Marina U. Bers at Tufts University.

When programming computers, the human brain tasks can be separated into two categories, code comprehension, and mentally simulating the program procedures. In this study, the researchers chose to focus on code comprehension, because computation thinking may not involve any programming knowledge.

“It is important to note that code comprehension may be cognitively and neurally separable from cognitive operations required to process program content, that is, the actual operations described by code,” the researchers wrote. “For instance, to predict the output of the program that sums the first three elements of an array, the programmer should identify the relevant elements and then mentally perform the summation.”

Moreover, the researchers point out that code comprehension is a “novel cognitive tool, typically acquired in late childhood or in adulthood," and that "we expect it to draw on preexisting cognitive systems.”

The challenge for the team was to observe the cognitive processes that support code comprehension. To answer this question, the researchers set out to use neuroimaging to locate the areas of the brain that are activated for code comprehension. Specifically, the team used functional magnetic resonance imaging (fMRI).

“Neuroimaging research is well positioned to disentangle the relationship between code comprehension and other cognitive domains,” the researchers wrote.

There have been prior neuroimaging studies on code comprehension with inconclusive results. According to the researchers, none of the prior research “sought to explicitly distinguish code comprehension from other programming-related processes, and none of them provide quantitative evaluations of putative shared responses to code and other tasks, such as working memory, math, or language.”

The study participants were native English speakers with working knowledge of Python or ScratchJr.

In data science, Python is one of the most popular languages, and is frequently used for AI machine learning purposes. Among the reasons why Python is popular for machine learning is its ease of use and readability. Python is considered a fourth-generation programming language (4GL), a genre of high-level languages that is designed to be user-friendly and more intuitive to program as commands consist of statements similar to human language versus low-level programming languages such as Assembly language. Python is one of the most used programming languages among developers worldwide in 2020, ranking number four behind JavaScript, HTML/CSS, and SQL per a Statista survey in February of over 57,000 respondents. In the U.S., the average salary for Python developers is $111,896 per year with a cash bonus of $5,000 per year according to 2020 figures from Indeed. The number of software developer jobs is expected to increase 22 percent from 2019 to 2029, and the median pay in 2019 for software developers is $107,510 per year according to September 2020 figures from the U.S. Bureau of Labor Statistics.

ScratchJr is an introductory programming language with graphical coding blocks designed to teach programming to children (ages 5 to 7 years old) that was developed by the MIT Media Lab in collaboration with Tufts University and the Playful Invention Company. ScratchJr is based on the block-based visual programming language Scratch with over 64 million registered users in over 150 countries.

The researchers looked at the brain’s multiple demand (MD) network and language system responses to the text-based Python code and graphical ScratchJr in two separate experiments. The multiple demand system, located in the bilateral frontal and parietal brain regions, is often active during complex cognitive tasks, and is therefore associated with fluid intelligence.

For both experiments, the researchers compared responses to code problems with responses to content-matched sentence problems. They discovered that the brain’s multiple demand system showed robust bilateral responses for text and graphical based coding. However, in contrast, the brain’s language system had a strong response to sentence problems, but “weakly or not at all to code problems.” This led the researchers to conclude that the brain’s multiple demand network “supports the use of novel cognitive tools even when the input is structurally similar to natural language.”

The results of the study suggest that learning to program involves both the brain’s multiple demand network and language systems. This new finding reveals that to the human brain, the process of code comprehension is not the same as reading language. Based on the study results, from an education perspective, teaching computer coding like a foreign language may not be the most efficient approach.

“Overall, we provide evidence that code comprehension consistently recruits the MD system – which subserves cognitive processing across multiple cognitive domains – but does not consistently engage the language system, in spite of numerous similarities between natural and programming languages,” concluded the researchers. “By isolating neural activity specific to code comprehension, we pave the way for future studies examining the cognitive and neural correlates of programming and contribute to the broader literature on the neural systems that support novel cognitive tools.”

Copyright © 2020 Cami Rosso All rights reserved.

More from Cami Rosso
More from Psychology Today
More from Cami Rosso
More from Psychology Today