A recent study published by Nature by Chet et al. (2020) found that that reasoning ability, memory capacity and language ability were far more important factors than math skills when learning to program in Python.
The commentary in the popular press is that this study shows that learning foreign languages is better preparation to become a computer programmer than studying math. That certainly agrees with my own experience. I only took two math classes in college (Calculus 2 and statistics), whereas I took 7 language classes (Spanish and Latin) in college, before I taught myself C when I was 22 years old. I recalling thinking at the time that it was much easier to learn a computer language than a human language.
The question raised by the findings in Chet et al. (2020) is whether computer science programs should change their requirements for getting a degree. Computer science degrees typically require two calculus classes, plus a statistics or probability class, and some require a class on matrix mathematics as well. They typically do require a general English and/or writing class, but they don’t typically require any study of a foreign language, linguistics, philosophy or formal logic, which develop abilities that Chet et al. found to be more useful than math in learning Python.
Despite the fact that I have never used calculus, matrix math or even statistics in my own programming, I can see the justification for requiring each of these. My calculus classes have given me a insight into how lots of things are calculated like area under a curve and integrations. It is easier to understand how 3D graphics works if you know matrix mathematics. It is easier to understand how encryption and security works if you understand probability. I can’t say that statistics have helped me as a programmer, but I am so glad that I took a class in statistics, because it makes me generally more knowledgeable about how to evaluate any study that I read. My statistics class taught me to pay attention to sample sizes, how the sampling was done to get a representative sample, and how questions are asked.
Nonetheless, I also know that a person can have a fine career as a professional programmer, without knowing much math. As someone who got a BA and MA in history, but never took a single computer science class, my experience as a computer programmer shows that there are multiple paths to learning how to code. Having studied 5 foreign languages and having learned some linguistics gives me a much greater appreciation for how computer science languages are constructed. It is hard for me to say whether having studied Latin helped me learn C, but I know that they required similar thought processes when learning both of them, since they are both logical languages with complex grammar rules.
The other major question that has to be asked after reading Chet et al. (2020) is why is there such a large gender gap in the computer science field if language skills are more important than math for learning how to code. Only 18% of computer science majors in the US are women, but there are generally more women than men with majors in English and foreign languages.
In a way, it is good news that language ability is more important than math for learning to code, since a larger percentage of the population have strong language skills and women generally do well in language abilities compared to men. However, it makes the gender imbalance in computer programming even more difficult to explain, if math skills aren’t the limiting factor in becoming a programmer.
I’m not sure how much to trust this study, since it was based on 36 people learning Python over 10 sessions of 45 minutes. There isn’t much mathematical reasoning involved in learning to program in Python. It helps to understand Boolean logic and bitwise operators if you have studied math, but I can’t say that math skills are that essential when learning basic programming.
Where I think studying math helps is the kind of logical reasoning that you have to use when figuring out how to solve coding problems. Math also helps when you are trying to figure out how to optimize something, like deciding which search algorithm is better. Few programmers, however, do the kind of work where much math is required. Only a couple times have I needed to use math in my own programming, and they only required using algebra which I learned my freshman year in high school.
I don’t think that it takes very specialized cognitive ability to become a programmer. Most people have the basic logical thinking skills that are required. There is some creativity involved in imagining how to set up your code and time is spent thinking logically about what will happen in this situation or that situation. Programming, however, is mostly a process of trial-and-error and dogged persistence. The most important factor isn’t cognitive ability in my opinion, but rather an inherent fascination with how things work and being willing to keep doing something over and over with minor changes each time until you get it to work. Another important factor is the ability to study your own and the ability teach yourself, since programmers often have to learn new languages and tools on their own.
I have often wondered about the gender imbalance in programming. Focusing on cognitive ability in my opinion is the wrong avenue to understand the problem, because I don’t think that cognitive ability is the determining factor in whether a person keeps studying programming. Far more important is whether the student finds it interesting and is willing to keep working at it, since it is mostly willingness to use systematic trial-and-error and persistence that determines whether a person learns to program.
Studies show that male children are more likely to gravitate toward playing with things, whereas female children are more likely to gravitate toward play that is oriented around other people. A metastudy about gender imbalance in STEM fields by Su and Rounds (2015) concluded that:
The patterns of gender differences in interests and the actual gender composition in STEM fields were explained by the people-orientation and things-orientation of work environments, and were not associated with the level of quantitative ability required.
There seems to be clear gender differences in the degree of interest in working with things vs working with people. It is an interesting question as to what degree women are socialized to value people-oriented work and men are socialized to value thing-oriented work. It is often very difficult to untangle nature vs nurture questions, but I do think that some of this difference in interests is hardwired. When I watch children play, I am struck by the number of male children that are fascinated by a thing, whereas more of the girls are playing together and their games are based on interacting with each other. Today, the thing that seems to most fascinate male children is cell phones. I am shocked by the number of boys that I see sitting alone playing electronic games on cell phones.
I once watched a boy play the same level in an electronic game over and over, trying one thing after another, until he finally solved the level. First, he tried changing just one little thing each time. Then, he tried changing his whole strategy for how to solve the level, and then he tried changing little things with that new strategy.
It struck me as I watched the boy playing that a computer programmer does exactly the same thing when solving a problem. A programmer systematically tries changing one thing after another until she finds something that works correctly. If she can’t get it to work that way, then she backs up and tries a whole new approach and sees if that new approach seems promising. Then, she starts changing little things with that new approach, running the program over and over with minor changes until she finds something that works. It is very repetitive, but a child who is determined to keep running the same level in a game over and over, changing one thing each time until she finds the solution, is likely to be a good programmer.
However, I’m not willing to discount nurture as one of the factors in determining why so few women become computer programmers. Male and female children are socialized differently and steered toward certain fields of play, and there are certainly societal pressures that tell the different genders what they should and should not like to do. I haven’t read any academic studies on this, but I certainly notice that male children are allowed to sit and play unmolested with an electronic gadget, whereas female children are scolded if they do the same, since they are expected to attend to the family with tasks like taking care of younger siblings and helping with the cooking and cleaning.
I also think that the high male ratio in computer science classes and programming companies does discourage some women from entering the field. The frequent reports of sexism in Silicon Valley companies certainly would make some women question whether they want to work in a male-dominated field. Almost every woman who is a programmer that I’ve talked to has a story about dealing with some male professor or manager with sexist attitudes.
Even when there isn’t overt sexism, I think that the gender imbalance in a field like computer science does discourage some women. It is harder for a woman to ask her fellow students/workers for help on a problem when they are mostly the other gender. It is harder for the woman to socialize with the rest when she is the only female in the group. I observed that the male programmers at the open source company where I worked for 10 years were more likely to go out and drink together after work, whereas the women were less likely to be included. Something else that I observed at that same company was that the men were more likely to hold the more technical jobs that paid better and hold more prestige in the company.
When I look at how coding has changed since 1995 when I first learned to code, I am struck by how much of what people learn in computer science classes is never used by professional programmers. The books that I learned from spent a lot of time covering topics like data structures and search algorithms, that I have rarely ever used, because most of that is handled by databases. It certainly helps to understand how databases work at a low-level when designing a good database for your data, but very few programmers do that kind of lower-level programming any more. It also helps to understand how bit fiddling and binary logic circuits work, but most professional programmers that I know haven’t used a bitwise operator in years.
For me, a degree in computer science means that you have taken the time to study computers at a lower-level, so you have a basic idea how databases and compilers are constructed and you have some idea of the underlying math. I guess at the end of the day, I probably wouldn’t change the math requirements for a computer science degree, or even what classes are offered by computer science departments, because good programmers should understand how things work on a lower level in a computer. Nonetheless, I find it fascinating how easily professional programmers can ignore most of what is taught in computer science courses, and still be highly effective programmers.