dark mode light mode Search Menu
Search

Your Brain on Coding

Pinchofhealth on Flickr

Think about this. You’re about to learn a new computer programming language. You don’t know the syntax. But you are told the first command will be to add 5 and 3. Maybe it will be as straightforward as using your calculator to punch 5, then the plus sign, then 3, and hit equal. Maybe it will be a drag-and-drop system like Scratch. Or, maybe you will need to create a little loop, like Python.

Organizing your thoughts in different systems is frustrating you. More information is needed, but your brain is saying you should quit now. Success! You have reached a Productive Failure.

A productive failure is when you don’t succeed, but you are now ready to get down to the real work at hand. The effort you put into trying to understand the new language warmed up your brain. And now your brain is producing more chemicals that can help you learn. These chemicals make it easier to get to the right answer the second or third time around.

Epinephrine

When you get stressed by a programming question, your brain tells your body to make the chemical epinephrine, also known as adrenaline. Epinephrine lets you access more parts of the brain and memorize more quickly. It also helps your brain stay focused.

But a little bit goes a long way. Sometimes your body sends too much. That is when you get a strong feeling that you should run away from the problem. Literally, you want to stand up and run. This chemical is part of our body’s flight-or-fight system. Obviously, the computer program isn’t going to reach out and bite you, but your brain is thinking it might. When you feel that way, take a deep breath, in and out through your nose to a count of three. After a moment, you’ll be ready to work. And that breathing exercise will bring on the next brain chemical.

Dopamine

Dopamine is a little splash of happiness. This chemical is always available, but you can increase it with training and work. First, you need to notice it.

You get this shot of happiness when you check something off a list, turn in an assignment, or go for a run. Dopamine also kicks in when you write part of the code correctly. Before you get upset that you don’t have the whole problem figured out, take a moment to notice what you did right. Your brain will catch on and reward your efforts.

On to a bigger challenge. Your brain also produces dopamine when you’re doing something hard but worthwhile. For example, when you practice a musical instrument, telling yourself you want to get better increases dopamine. The same is true of coding. If you tell yourself this is worthwhile, your body will produce dopamine and you will feel happier.

And More

There are other chemicals in our brains that allow us to code and do other work more easily.

Serotonin helps us feel contentment and get over failure. We can increase serotonin through exercise and getting out in the sun. Another chemical, cortisol, helps us stay awake and alert. and exercise can help keep it at a good level. Also, most people have more dopamine, serotonin, and cortisol during the daytime.

When you understand how to work with the chemicals in your brain, tasks like coding and learning in general become easier to manage.

Quick guide:

  • Warm up by attempting a hard puzzle to get your epinephrine (adrenaline) pumping.
  • Tell yourself you are working on coding, and that is worthwhile. Notice when you master a small piece. Train yourself to appreciate the accomplishment.
  • Work in the daytime to get the most out of these brain chemicals.
  • Notice feelings of contentment.
  • Get some exercise and spend time in the sunlight. 

These things help keep brain chemicals in balance.

Learn More

If You’re Not Failing, You’re Not Learning

https://www.edutopia.org/article/if-youre-not-failing-youre-not-learning/

Using Productive Failure to Activate Deeper Learning

https://www.timeshighereducation.com/campus/using-productive-failure-activate-deeper-learning

Productive Failure

https://www.stem-spark.com/study-spotlight/productive-failure

Benefits of Productive Failure in STEAM

https://steam.tinkrworks.com/blog/how-students-benefit-from-productive-failure-in-steam

4 Ways Coding Fuels Cognitive Development

https://www.codewizardshq.com/coding-cognitive-development/

Brainy Benefits of Coding

https://www.thecodingspace.com/blog/2022-06-02-3-brainy-benefits-of-coding/

4 Brain Chemicals That Make You Happy

https://www.happyfeed.co/research/4-brain-chemicals-make-you-happy

Train Your Brain

https://www.health.harvard.edu/mind-and-mood/train-your-brain

11 Reasons To Do Hard Things

https://apexpwr.com/blog/11-reasons-to-do-hard-things/

Dopamine and Serotonin: Our Own Happy Chemicals

https://www.nationwidechildrens.org/family-resources-education/700childrens/2023/02/dopamine-and-serotonin