This is your brain on code: JHU researchers decipher neural mechanics of computer programming

Using fMRI scans of computer programmers as they read code, researchers have discovered that the complex language processing takes place in the left hemisphere in a part of the brain dedicated to logical reasoning

Name
Jill Rosen
Email
jrosen@jhu.edu
Office phone
443-997-9906
Cell phone
443-547-8805
Twitter
JHUmediareps

By mapping the brain activity of expert computer programmers while they puzzled over code, Johns Hopkins University scientists have found the neural mechanics behind this increasingly vital skill.

Though researchers have long suspected the brain mechanism for computer programming would be similar to that for math or even language, this study revealed that when seasoned coders work, most brain activity happens in the network responsible for logical reasoning, though in the left brain region, which is favored by language.

Graphic of brain activity

Image caption: The graphic shows the how the brain activates during computer programming, compared to brain activations for logical reasoning and language.

Image credit: Johns Hopkins University

"Because there are so many ways people learn programming, everything from do-it-yourself tutorials to formal courses, it's surprising that we find such a consistent brain activation pattern across people who code," said lead author Yun-Fei Liu, a PhD student in the university's Neuroplasticity and Development Lab. "It's especially surprising because we know there seems to be a crucial period that usually terminates in early adolescence for language acquisition, but many people learn to code as adults."

The findings were published this week in the journal eLife.

Researchers have long known what happens in the brain when someone reads, plays music, or does math. But despite our increasing reliance on technology, almost nothing is known about the neural mechanisms of computer programming.

"People want to know what makes someone a good programmer," Liu said. "If we know what kind of neuro mechanisms are activated when someone is programming, we might be able to find a better training program for programmers."

Many people assume techies have math-centric minds, and think the brain region for programing would be the same as the one used when solving math problems, Liu said. Others believe that programming languages are called languages for a reason and the neural mechanism underlying programming would be shared with language processing. Or it could be parts of the brain used for logical reasoning or the type of problem-solving known as "executive control."

"Because there are so many ways people learn programming, everything from do-it-yourself tutorials to formal courses, it's surprising that we find such a consistent brain activation pattern across people who code."
Yun-Fei Liu
PhD student, Neuroplasticity and Development Lab

To get to the bottom of it, Liu had 15 experienced programmers, each highly proficient in the programming language Python, lie in an fMRI scanner so he could measure their brain activity while they worked on coding questions.

In each case, the same part of the brain lit up: the area responsible for logical reasoning. And though the act of logical reasoning has no brain hemisphere preference, coding strongly favored the left hemisphere, the area that correlates with language.

Next, the lab hopes to determine if learning to code, like learning a language, is easier for the young.

"It's true that adults can learn to code but are kids even better at it? Or maybe coding doesn't have a critical learning period and that's what makes it special," said senior author Marina Bedny, an associate professor in the Department of Psychological and Brain Sciences. "It could be that our education system is wrong, and we should be teaching kids to code in middle school or else they're missing an opportunity to be the best they can."