For the brain, reading computer code is not the same as reading language | MIT News

In some ways, learning to program a computer is similar to learning a new language. It requires learning new symbols and terms, which must be properly organized to instruct the computer what to do. The computer code must also be clear enough for other programmers to read and understand.

Despite those similarities, MIT neuroscientists have found that reading computer code does not activate the areas of the brain involved in language processing. Instead, it activates a distributed network called the multiple-demand network, which is also recruited for complex cognitive tasks such as solving math problems or crossword puzzles.

However, while reading computer code activates the network with multiple demands, it seems to rely more on different parts of the network than math or logic problems, suggesting that coding doesn’t exactly replicate the cognitive demands of math, either.

“Understanding computer code seems to be its own thing. It’s not the same as language, and it’s not the same as math and logic, ”said Anna Ivanova, an MIT graduate student and the lead author of the study.

Evelina Fedorenko, the Frederick A. and Carole J. Middleton Career Development Associate Professor of Neuroscience and a member of the McGovern Institute for Brain Research, is the senior author of the paper, which appears today in eLife. Researchers from MIT’s Computer Science and Artificial Intelligence Laboratory and Tufts University were also involved in the study.

Language and cognition

An important focus of Fedorenko’s research is the relationship between language and other cognitive functions. In particular, she has studied the question of whether other functions depend on the brain’s language network, which includes the Broca’s area and other regions in the left hemisphere of the brain. In previous work, her lab has shown that music and math do not seem to activate this language network.

“Here we were interested in exploring the relationship between language and computer programming, in part because computer programming is such a new invention that we know there cannot be hardwired mechanisms that make us good programmers,” says Ivanova.

There are two schools of thought about how the brain learns to code, she says. It is believed that to be able to program well, you have to be good at math. The other suggests that language skills may be more relevant because of the parallels between coding and language. To highlight this problem, the researchers wanted to investigate whether patterns of brain activity while reading computer code would overlap with language-related brain activity.

The two programming languages ​​that the researchers focused on in this study are known for their readability – Python and ScratchJr, a visual programming language designed for kids ages 5 and up. The subjects in the study were all young adults who were proficient in the language they were tested on. While the programmers lay in a functional magnetic resonance (fMRI) scanner, the researchers showed them pieces of code and asked them to predict what action the code would produce.

The researchers saw little or no response to code in the language areas of the brain. Instead, they found that the encryption task primarily triggered the so-called multiple-demand network. This network, whose activity is spread across the frontal and parietal lobes of the brain, is typically recruited for tasks that involve keeping many pieces of information in mind at once, and is responsible for our ability to perform a wide variety of mental tasks. to feed.

“It does pretty much anything that is cognitively challenging that makes you think hard,” says Ivanova.

Previous studies have shown that mathematical and logical problems seem to rely mainly on the multiple question regions in the left hemisphere, while tasks involving spatial navigation activate the right hemisphere more than the left hemisphere. The MIT team found that reading computer code appears to activate both the left and right sides of the multiple-demand network, and ScratchJr activated the right side slightly more than the left side. This finding contradicts the hypothesis that math and coding rely on the same brain mechanisms.

Effects of experience

The researchers say that while they have not identified regions that appear to be solely dedicated to programming, such specialized brain activity could develop in people who have much more coding experience.

“It is possible that if you take people who are professional programmers who have spent 30 or 40 years coding in a particular language, you may start to see some specialization or some crystallization of parts of the multiple-demand system”, says Fedorenko. “For people who are familiar with coding and can perform these tasks efficiently, but have relatively little experience, it just seems like you don’t see any specialization yet.”

In an accompanying document in the same issue of eLifea team of researchers at Johns Hopkins University also reported that solving code problems activates the multiple-demand network instead of the language regions.

The findings suggest that there is no definitive answer to whether coding should be taught as a math-based skill or a language-based skill. In part, that’s because learning programming can draw on both language and multiple question systems, even if – once learned – programming doesn’t depend on the language areas, the researchers say.

“There are claims from both camps – it has to be along with math, it has to be along with language,” says Ivanova. “But it looks like IT educators will have to develop their own approaches to learn code most effectively.”

The research was funded by the National Science Foundation, MIT’s Department of the Brain and Cognitive Sciences, and the McGovern Institute for Brain Research.