Skip to main content

Verified by Psychology Today


Learning to Code Requires Language Skills, Not Math

Not a math person? You may be better at learning to code than you think.

New research might widen access to learning computer programming.
Source: skynesher/iStock

It is routinely assumed that to be a computer programmer—to write code, in other words—you need to be good at math. But new research from the University of Washington suggests that is not necessarily the case. Being a strong language learner proved to be a better predictor of learning to program than basic math knowledge. The findings hint at the neural and cognitive bases of learning a modern programming language. They also “could make learning programming much more accessible,” says cognitive neuroscientist Chantel Prat , who led the study.

Prat studies individual differences in complex cognitive abilities. “I’m really interested in how your biology and your experience combine to produce different ways in which people can kind of grab on to information,” she says. Her newest research , published in Scientific Reports this month, builds on earlier work on the cognitive underpinnings of reading and learning second languages.

She has previously shown that looking at people’s brains in a resting state, when they are not actively engaged in a task, can predict the ease with which they learn a second language. In those studies, adult English speakers sat quietly for five minutes with their eyes closed while Prat and her colleagues recorded the electrical activity in their brains. With the resulting information on basic information processing in brains at rest, the researchers predicted 60 percent of the variability in how quickly participants learned French, “which was as good or better than these two and a half hour behavioral tests that were developed over decades to measure language aptitude,” Prat says.

In the new work on coding, she wanted to explore further what it means to be a good learner of a complex skill that involves the manipulation of symbols. She was also struck by an incongruency. Programming languages are designed to mimic human communication, yet, in schools, they are usually housed within engineering departments. That has proven to be a barrier to entry for those who don’t think of themselves as an engineer. “There is a huge percentage of jobs that ask for coding skills,” Prat says. “It’s not quite as important as knowing how to read, but I can imagine in 30 years knowing how to code will be comparable in terms of being able to get a job, how much money you’ll make, things like that.” While some kinds of programming jobs will indeed require engineering and advanced math skills, others may not.

Prat was partly inspired by the work of psychologist Sapna Cheryan , also at the University of Washington, who studies women in STEM fields. While the gender gap in fields like biology doesn’t exist anymore, it is still strong in computer science, where less than 20 percent of majors are women. “[Cheryan’s] research suggests that a huge barrier to that is attitudes about what people think programmers are like,” Prat says.

In the new study, Prat brought in 36 adults who had no experience of coding whatsoever. Participants took a modern language aptitude test, which is designed to test natural language learning, and they were tested on general cognitive abilities such as fluid reasoning and working memory as well as numeracy.

Then, each participant came into the laboratory for ten 45-minute sessions to learn the programming language Python through an existing online curriculum called Codecademy. When the sessions were complete, Prat and her colleagues measured how far participants had progressed, how quickly they had moved through the lessons, and how well they had learned the material. For instance, in a multiple-choice post-test, there were questions about the syntax, structure, or function of the code they had learned. Participants also had to write some basic code in a rock, paper, scissors programming exercise.

Of all the variables the researchers considered in the outcomes they assessed, they found that the modern language aptitude test was the strongest predictor of how quickly people would learn to code in Python, “much stronger than we thought,” Prat says. Her measurements of resting-state brain activity were also predictive. In fact, both language aptitude and resting brain activity explained a larger percentage of the variance in learning rate than numeracy. For example, they were able to explain 72 percent of the variance in learning rate with four factors. Of that 72 percent, language aptitude explained 43 percent, fluid reasoning explained 12.8 percent, the brain index Prat created explained 10 percent and numeracy just 6 percent.

“This is the first study that pits math against communication abilities or your ability to learn a symbolic communication skill, and showed that language was a much stronger predictor,” Prat says. “I think that’s really important for breaking down the stereotypes of what a good programmer looks like.”

She hopes that the work on intrinsic brain function will not just allow the prediction of who will be good at coding, but also someday make it possible to teach almost everybody. “If we can match existing teaching software to a particular way a brain is wired up and we can leverage what we know about cognitive neuroscience, then that’s a first step to developing training programs that are targeted for everybody’s brain.”

Copyright: Lydia Denworth, 2020.


Prat, Chantel S., et al. "Relating Natural Language Aptitude to Individual Differences in Learning Programming Languages." Scientific Reports 10.1 (2020): 1-10.