It’s true: programmers think differently than everyone else.
Not to say that programmers are necessarily smarter, more logical, or more rational than everyone else, as is commonly said. But scientists have recently started studying the brains of programmers and have come to some interesting conclusions.
Just as artistry can shape your mind in various ways, computer programming also affects your brain and how you think—perhaps in ways you may not have expected.
1. Coding Shapes Your Mental Models
Does it matter which programming language you learn first? Yes!
This seems a bit unfair, doesn’t it? After all, most of us get our first taste of programming in school, and we don’t get to choose which language gets thrust upon us. I started with C. Those older than me likely started with FORTRAN, COBOL, or BASIC. As for you newer folks? You likely started on Java or Python.
No doubt about it: the design of a programming language shapes how you think. Edsger Dijkstra, one of history’s most influential computer scientists, knew this when he said:
“The tools we use have a profound (and devious) influence on our thinking habits, and, therefore, on our thinking abilities.”
He then went on to say:
“The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.”
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
In one sense, all programming languages are equally capable in that they’re all Turing-complete. But in another sense, mastery of one language can lead to ruin in another language. Java programmers and Python programmers are two different beasts who approach coding in two completely different ways.
In other words, the paradigms and idioms of your first programming language influence and even dictate how you think about data structures, algorithms, etc.
So much so, in fact, that it’s actually possible to take anonymized code and determine who wrote it based solely on how the task was approached and how the code was written. The more difficult the task, the easier it is to “de-anonymize.”
See this paper on code stylometry [No Longer Available] and this code stylometry lecture transcript:
“Programmers can obfuscate their variable or function names, but not the structures they subconsciously prefer to use or their favorite increment operators.”
In English, we have a proverb that sums this up in an easy-to-understand way: “When all you have is a hammer, everything looks like a nail.” Likewise, once you learn how to program in a certain way, it’s tempting to think about all problems in that way.
So when choosing a programming language, be smart and be careful!
2. Programming Helps Strengthen Brain Health
People often say that the brain is like a muscle and that you need to exercise it if you want to stay sharp. Is that actually true? And if so, does programming count as mental exercise, enough that it impacts brain health?
A 1991 meta-study looked at “the effects of computer programming on cognitive outcomes” and found that students with computer programming experience scored 16 percentile points higher on cognitive ability tests than students without.
A bigger study in 1999 found and confirmed that “intellectually engaging activities serve to buffer individuals against [cognitive] decline,” but also noted that it’s possible that cognitive decline could lead to less participation in intellectually engaging activities.
An even bigger study in 2009 arrived at a similar conclusion, suggesting that “people who engage in brain-stimulating activities in later years can reduce their risk [and even delay the onset of] Alzheimer’s and other types of dementia.” Brain-stimulating activities included reading, writing, puzzles, board and card games, and playing music.
Lastly, a study published in 2013 found that only certain kinds of mental engagement actually lend to sharper brains, namely high-demand cognitive activities that involve learning and intellectual difficulty.
More research needs to be done, of course, but it’s hard to think of any cognitive activity that’s more demanding and learning-centric than programming.
Furthermore, while none of these studies show that intellectually-engaging activities make you smarter or more capable, they do show that high-demand cognitive tasks at least extend your current brain health and significantly prevent neural deterioration.
3. Coding Isn’t All Math and Logic
According to a 2014 study [PDF] that used fMRI scans to observe brain activity while programmers tried to work through and comprehend code snippets, five distinct areas of the brain are involved in understanding source code:
- BA 6: Middle frontal gyrus (Attention, language, working memory)
- BA 21: Middle temporal gyrus (Semantic memory retrieval)
- BA 40: Inferior parietal lobule (Working memory)
- BA 44: Inferior frontal gyrus (Working memory)
- BA 47: Inferior frontal gyrus (Language, working memory)
This means that working through source code mainly uses parts of the brain that are normally associated with language processing, memory, and attention.
What’s notably missing are regions of the brain normally associated with math and calculations, which barely registered—even when comprehending code snippets that involved loops, conditionals, arithmetic, and other algorithmic operations.
Of course, this study is somewhat incomplete, and the researchers admit as much:
- The snippets in the experiment were under 20 lines of code and time-limited, meaning they weren’t difficult enough to truly challenge subjects.
- The evidence doesn’t suggest that programming languages are like foreign languages, only that they involve similar regions of the brain.
- The subjects didn’t write any of their own code, which would likely involve different areas of the brain than trying to understand existing code.
But here’s what we can walk away with:
We know that programmers regularly review source code, whether code that’s self-written or belongs to somebody else. We also know that programmers often spend more time fixing and refactoring code than writing new code from scratch.
So this study isn’t meaningless. Programming isn’t just a “left-brained activity,” and one might even argue that right-brained programmers have an edge in this sense.
Learning How to Be a Better Programmer
Programming skills don’t come easy, but they will come if you keep up the practice. Check out our tips for mastering any programming language, our article on the benefits of a programming journal, and our favorite lessons for self-taught coders. If you want to take the plunge with a specific programming language, tackling a project is a good idea. Check out how to learn C programming with this beginner project.
Finally, I recommend watching these TED Talks for programmers, which include all kinds of tips, thoughts, inspirations, motivations, and histories that may help you out.