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.
"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 are published today 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."
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 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."