Sun. Oct 2nd, 2022
Image of a pillar covered with illuminated ones and zeros.

In the US, a 2016 Gallup poll found that the majority of schools want to teach code, with 66 percent of primary and secondary school principals believing that computer science learning should be integrated into other subjects. Most countries in Europe have added programming classes and computer science to their school curricula, and France and Spain introduced theirs in 2015. This new generation of programmers is expected to increase the global developer population from 23.9 million in 2019 to 28.7 million in 2024.

Despite all these efforts, there is still some confusion about how to teach coding. Is it more of a language, or more of math? Some new research may have solved this question by watching the activity of the brain as subjects read Python code.

Two schools about education

Right now there are two schools of thought. The prevailing one is that coding is a type of language, with its own grammar rules and syntax to follow. After all, they’re called encryption languages for a reason, right? This idea even has its own hip acronym: Coding as Another Language, or CAL.

Others think it’s a bit like learning logic in math; formulas and algorithms to create output from input. There’s even a free online course to teach you coding and math at the same time.

Which approach is more effective? The debate has been going on since coding was first taught in schools, but it seems the language argument is now winning. Laws in Texas, Oklahoma, and Georgia allow high school students to take computer science to earn their foreign language credits (the Texas law of 2013 says this applies if the student has already taken a foreign language class and the seems unlikely to continue).

The debate is of particular interest to neuroscientists; since computer programming has only been around for a few decades, the brain hasn’t developed a special region to deal with it. It must be a repurposing of a part of the brain that is normally used for something else.

Late last year, neuroscientists at MIT were trying to see which parts of the brain people use in computer programming. “The ability to interpret computer code is a remarkable cognitive skill that shows parallels to several cognitive domains, including general executive functions, mathematics, logic and language,” they wrote.

Since coding can be learned as an adult, they thought it had to rely on a pre-existing cognitive system in our brains. Two brain systems seemed likely candidates: either the brain’s language system, or the system that tackles complex cognitive tasks, such as solving math problems or doing crossword puzzles. The latter is known as the ‘multiple demand network’.

Coding on the brain

In their experiment, researchers asked participants who were already adept at coding to lie in an fMRI machine to measure their brain activity. They were then asked to read a coding problem and were asked to predict the output.

The two coding languages ​​used in the study are known for their “readability”: Python and ScratchJr. The latter has been specially developed for children and is based on symbols, so that children who have not yet learned to read can still use it.

The main task was to give the participants a person’s height and weight and ask them to calculate a person’s BMI. This problem was presented either as Python style code or as a regular sentence. The same method was used for ScratchJr, but participants were asked to track a kitten’s position as it walked and jumped.

Control tasks include memorizing a series of squares on a grid (to activate the participants’ multiple question system) and reading a normal and a nonsensical sentence (to activate their language system).

Their results showed that the language part of the brain reacted weakly to code reading (the authors of the paper believe this is due to not speaking/listening). Instead, these tasks were usually handled by the multiple demand network.

Spread across the frontal and parietal (top) lobes of our brains, the multiple demand network is responsible for intense mental tasks — the parts of our lives that make us think. The network can be roughly divided into the left part (responsible for logic) and the right part (more suitable for abstract thinking). The MIT researchers found that reading Python code seems to activate both the left and right sides of the multiple question network, and ScratchJr activated the right side slightly more than the left.

“We found that despite the many similarities between code and natural languages, the language system does not respond consistently during code understanding,” they write.

Interestingly, solving codes activated parts of the multiple question network that are not activated when solving math problems. So the brain doesn’t handle it as language or logic – it seems to be its own thing.

The clear-cut process involved in interpreting computer code was supported by an experiment done by Japanese neuroscientists last year. This work showed snippets of code to novice, experienced and experienced programmers while in an fMRI. The participants were asked to classify them into one of four types of algorithms. As expected, the higher-skilled programmers were better at categorizing the fragments. But the researchers also found that activity in areas of the brain associated with natural language processing, episodic memory retrieval, and attentional control also grew stronger with the programmer’s skill level.

So while coding may not be as similar to languages ​​as we imagined, it seems that both benefit from starting young.

eLife2020. DOI: 10.7554/eLife.58906 (About DOIs).

Fintan is a freelance science journalist based in Hamburg, Germany. He has also written for The Irish Times, Horizon Magazine and and covers European science policy, biology, health and bioethics.

By akfire1

Leave a Reply

Your email address will not be published.