programmers brain

Programmers use existing language regions of the brain to understand code.

Computer programming is a deeply complex but relatively new human activity. Its young age has lent itself to countless battles and hotly debated topics that despite the many compelling arguments presented, we seemingly have no definitive answers for. All that is about to change: An international team of scientists lead by Dr. Janet Siegmund is using brain imaging with fMRI to understand the programmer’s mind. Understanding the brain offers us the chance to distill these complex issues into fundamental answers.

 

 

One recent debate was prompted by recent legislation that considered offering foreign-language credits for students learning programming languages. There were many strong reactions across the software-developer community. Some sensibly-minded developers considered the effort laudable but misguided, as there may be better ways to achieve the same goals of promoting computing education.

Other developers proclaimed programming was not at all like a human language and was much closer to mathematics:

“Its more math and science than anything”

On the other hand, Dijkstra once said:

Besides a mathematical inclination, an exceptionally good mastery of one’s native tongue is the most vital asset of a competent programmer.

Scientists are finding that there may be a deeper connection between programming languages and other languages then previously thought. Brain-imaging techniques, such as fMRI allow scientists to compare and contrast different cognitive tasks by analyzing differences in brain locations that are activated by the tasks. For people that are fluent in a second language, studies have shown distinct developmental differences in language processing regions of the brain. A new study provides new evidence that programmers are using language regions of the brain when understanding code and found little activation in other regions of the brain devoted to mathematical thinking.

NOTE: It’s never too late to learn how to be a programmer. The staff at DaVinciCoders will show you how.

An expert’s brain

Scientists have spent the past few decades slowly decoding how experts perform particular tasks. It is only a matter of time before programming is studied in the same way. Although the brain appears to have specialized areas for specialized tasks, when humans develop new skills, there is often no specific area of the brain that supports that skill. Instead, the brain often recruits the existing information-processing networks of the brain in support of the new skill. For example, the fusiform gyrus is strongly associated with face perception, but it also gets recruited when identifying a specific object, such as for bird experts who can distinguish between a vast variety of bird species or for car experts who can identify distinct differences between many models and makers of cars. Interestingly enough, bird experts who are not car experts do not use the fusiform gyrus when observing cars, and vice versa.

Not only does an expert’s brain recruit specific areas of the brain for new skills, experts sometimes also have increased brain mass in these areas. A larger right posterior parietal cortex is seen in expert videogame players. Experienced London taxi drivers have larger parahippocampal regions with size correlated with years of experience.

Finally, when novices are compared with experts performing the same kinds of tasks, the differences can be remarkable. When novice golf players try to perform a golf swing, their brains are alight with activity throughout many areas of the brain as they clumsily try to coordinate the swing in their mind, whereas experts have conceptualized the movements of a golf swing into a simple, focused, and energy-efficient action in the brain.

A Programmer’s Brain on Code

In the first study of its kind, Janet Siegmund and her colleagues observed 17 participants inside an fMRI scanner while they were comprehending short source-code snippets, which we contrasted with locating syntax errors. By comparing cognitively similar tasks, only the brain regions specific to understanding source code is observed.

The team found a clear, distinct activation pattern of five brain regions, which are related to language processing, working memory, and attention. The programmers in the study recruited parts of the brain typically associated with language processing and verbal oriented processing (ventral lateral prefrontal cortex). At least for the simple code snippets presented, programmers could use existing language regions of the brain to understand code without requiring more complex mental models to be constructed and manipulated.

Interestingly, even though there was code that involve mathematical operations, conditionals, and loop iteration, for these particular tasks, programming had less in common with mathematics and more in common with language. Mathematical calculations typically take place in the intraparietal sulcus, mathematical reasoning in the right frontal pole, and logical reasoning in the left frontal pole. These areas were not strongly activated in comprehending source code.

What the Future Holds

These new research results are a much needed, but only a first step in revealing the neuroscience of programming. There are many other interesting questions waiting for answers that might change the way we work and learn about code.

  • Can we finally provide a neurological basis for a programmer’s flow (being in the zone)?
  • What will studying an expert programmer’s brain reveal? How might years of programming experience manifest as changes in the brain?
  • How relevant is the mastery of language skills for programming? Will it make sense for educational programs introduce programming at an early age? How might computational thinking at an early age restructure our future minds? Is it worth teaching programming at a young age? If so, is there a critical period?
  • How does teaching programming practices such as object-oriented languages, design patterns, or functional programming influence how programmers comprehend code?
  • Are there certain programming activities that should never be mixed, due to higher chance of cognitive failure (and resulting bugs). For instance, code that requires mental models with spatial characteristics (maps, grids) while doing other programming activities that also occupy spatial processing.
  • Do code visualizations or live programming environments really reduce mental load?

Finally, programming involves a rich set of cognitive processes. Although the study found a particular pathway that was strongly associated with language processing, there may be other pathways associated with other common activities related to programming (debugging, editing, refactoring, etc). But we’ll get there.

Via Huffington Post