How Programming Affects Your Brain: 3 Big Truths According to Science

Joel Lee 23-02-2019

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 What Is Object Oriented Programming? The Basics Explained in Layman's Terms Most modern programming languages support the "object-oriented programming" (OOP) paradigm. But what exactly is OOP and why is it so useful? Read More .


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 Looking for the Best Programming Languages? Start Here! Whether you're completely new to programming languages or looking to jump into a new kind of programming, one of the most important questions to ask is: "Which programming language is right for me?" Read More , 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.

programming on a Mac

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.

We’ve previously argued that it’s never too late to start learning how to code, and these studies only serve to reinforce our position. Programming is good for your mental health How Learning Programming Can Help Your Mental Health Anxiety, stress, and intense mental health problems can be eased by learning with programming skills. Here's how it works. Read More !

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.

code on a Mac screen

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 6 Signs You Aren't Meant to Be a Programmer Not everyone is cut out to be a programmer. Is coding right for you? Here are some signs to point you in the right direction. Read More 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 20 TED Talks on Programming Everyone Must Watch With these TED Talks on programming, you will learn how to be a programmer. Knowing how to write code is one aspect of programming, but knowing how to think is key. Read More , which include all kinds of tips, thoughts, inspirations, motivations, and histories that may help you out.

Related topics: Programming, Psychology.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. pi2r2
    March 24, 2018 at 6:05 am

    The subjects didn’t write any of their own code? They weren't programmers, then.

  2. Dave
    March 24, 2018 at 1:26 am

    I take exception to this statement:
    "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."

    Maybe the students with higher cognitive abilities went into computer science, and those with lower went into less demanding fields, and so never took any programming classes.
    They could very well be confusing cause with effect.

    • Frank
      May 24, 2018 at 8:39 pm

      that's what I thought too!

  3. Jan Steinman
    March 23, 2018 at 6:30 pm

    Although it was not my first language, I have always been extremely grateful to have had the opportunity to use Smalltalk for a number of years.

    Beyond the language itself (which is almost trivial), was the open access to the environment. You could quickly see how almost everything was implemented. It was the world's first integrated programming environment, and even today, nothing really comes close. There were very few "hidden bits," whereas most IDEs these days just allow you to string together bits of source-invisible library code.

    But the bad news is that Smalltalk's purity of design, using a small number of vital concepts, rigorously employed, has spoiled me for most other languages. (Even "true," "false," and integers are objects!) I have to hold my nose and grit my teeth to use C, PHP, Javascript, etc. Ruby is the only thing that comes close to Smalltalk.

  4. dragonmouth
    March 21, 2018 at 7:48 pm

    “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.
    No, not 'ouch' but Bovine Excrement. Edsger Dijkstra may have been one of history’s most influential computer scientists but he also was an opinionated, elitist curmudgeon. Learning programming languages is like learning spoken languages. Exposure to Italian does not mentally mutilate one for German. Exposure to Chinese does not mentally mutilate one for Tagalog. There are millions of COBOL programmers who program very well in structured languages which Dijkstra developed and considered as the only proper and legitimate ones.

  5. Steven
    March 21, 2018 at 4:37 pm

    I must say in my experience that a left brain centric take on programming will not be sufficient to bring you past being simply an "average" programmer.

    Understanding and communicating with others (clients, colleagues, your future self) can be more important than raw technical ability!

    It takes care of exercising those remaining other parts of your brain.

    • John Brooking
      April 30, 2018 at 1:53 pm

      Beyond the ability to do well in the non-code writing aspects of your job, which I agree are important, I've always felt like right-brained creativity is also an integral part of coding, so I'm disappointed it wasn't mentioned. In fact, what I love most about coding is that I feel it exercises both sides of my brain at once. There are many ways to put code together, but they differ wildly in legibility, maintainability, and dare I say elegance, the latter being a bit harder to define technically, but like art, one feels one knows it when one sees it. Strive for elegance, balanced by appropriateness for the context, and as always, subject to available time.

  6. Elijah
    March 21, 2018 at 2:00 pm

    There is way to you much fuss about which language people learn first. It's pure bs.

    • Frank
      May 24, 2018 at 8:41 pm

      agreed, the language one is mostly intensely imposed and used, may be shaping one's mind as shaping modules take time and repetition!

  7. Tsar Bomba
    March 21, 2018 at 1:13 pm

    I've been at it professionally for a long time now and have used many languages in the job. No matter what you think of JavaScript it's still the best first language for new programmers. It's functional and object-oriented and eat to learn. It has always been the language of the web too.

  8. Waiel Grey
    March 21, 2018 at 12:52 pm

    What is the best language to start... Doesn't matter how old or hard it is, I want to shape my mind perfectly for any other future languages. Also what is the strongest one?

    • Justin Force
      March 21, 2018 at 2:55 pm

      Also, the idea that learning the wrong language will ruin your brain or make it hard to learn something else is laughable. You learn a language, you think of programming in terms of how that language works. It's confirmation bias. It doesn't mean you can't learn something completely different, just that you have to be aware of your bias. I've personally radically changed my style of JavaScript programming like 5 times since I learned it in 1998. Same language, completely different approach. If you're passionate about getting good, you will probably get good. It's all about effort and learning. Go get 'em!

  9. Waiel Grey
    March 21, 2018 at 12:48 pm

    What should I learn first, and does it matter if I am already 16... I want to start off with a good one, it can be hard.

    • Elijah
      March 21, 2018 at 2:05 pm

      Don't let that statement bother you.

      Programming is simply a the means to solving problems. Just figure out what tool best suits your needs.

      Start with a project. If you want to do websites. Use JavaScript , if you want to automate system tasks and file sorting, use python, if you want to make games, learn c#.

      The key is just ... Don't stop there. Languages are a tool. You can't build a house with one screwdriver. Familiarize yourself with as many as possible. Once you learn one, you're pretty much good to go on the rest.

      Also please never use age as an excuse . No matter how young or old you think you are.

    • Justin Force
      March 21, 2018 at 2:50 pm

      The question the way you frame it has no answer. There's no strongest or best language, and the utility doesn't scale with the difficulty. C is a tiny language, and it's the language operating systems tend to be written in. JavaScript is also pretty small, but you can do pretty much anything but operating systems with it (in theory you could do anything with JavaScript, but this is where that "right tool for the job" thing comes in). The reason there are lots of languages is because the respective creators of those languages looked at all the languages they could see and concluded that none of them were right for their problem and they invented a new one (I'm sure that's not universally true, but it's generally true enough). That said, learn JavaScript. You can use it to make games you can play in your browser on a computer or phone. You can program the server and client code in the same language. Read about BOTH object oriented JavaScript and functional JavaScript. Good luck. And have fun! Making something from nothing is so satisfying! This might be a fun place to start, but be prepared to go on research tangents. A lot of programming is reading and learning and understanding, not just cranking out code.