5 Ways to Stay Motivated While Learning to Code

This post may contain affiliate links that earn me a small commission at no additional cost to you. For more information read my Affiliate Disclosure.

17 min read

Motivation is a tricky topic. There were some things in my life for which I had strong burning desire in the beginning, but after a couple of weeks my motivation completely plummeted and often I even ended up hating this particular task, hobby or project. This can easily happen when you invest a lot of time into one and the same thing.

When we start learning a new skill, it is easy and exciting in the beginning. Everything is new, progress comes quickly and we feel unstoppable. However, this initial burst of motivation pretty much always subsides and often we are left with a feeling of emptiness and exhaustion. What once was fun and exciting and made us dream of big goals, suddenly seems boring, hard and not really worth it. Unfortunately, this is how our brain works. It is not built to enjoy doing the same thing for long periods of time, at least not if it becomes difficult and uncomfortable and if there is no form of regular short term gratification.

But learning to code is something we do with a long term goal in mind. It is hard and the learning process can be quite uncomfortable, especially when we don’t understand something right away. We know we can’t learn programming overnight and then expect to make a lot of money immediately. We have to learn a lot and we have to learn regularly and over a long period of time (pretty much for as long as we want to be developers). So how do we make sure that we constantly stay motivated or at least keep going if we don’t feel like it?

I have thought about this topic a lot. You could even say it’s a passion of mine, but a passion that developed out of necessity, because I want to do a lot of things and I want to do them with as much fun as possible. I read a ton of books, articles and blog posts about motivation and different techniques that are supposed to help me stay motivated. I read books like “Drive” by Daniel Pink or “Payoff” by Dan Ariely alongside a lot of others. I looked into concepts like habits, different mindsets and also less common techniques like gamification. 

Of course as usual what works for one person doesn’t automatically work for everyone, but we are not so different that some concepts don’t apply to almost every human. So let’s talk about 5 ways to keep up that motivation and help you reach your goals. And while this post is directed to my programmer audience, it doesn’t only apply to programming, but to pretty much every goal you in your life.

 

1. Ask yourself if you really want to do it

It sounds like something grandma would say, but I am pretty sure that money really does not make happy. It is also a terrible long term motivator. And this totally makes sense, because how can you be happy when you do something that you hate 8 hours a day, 5 days a week, just to make up for it by buying things that you can enjoy on the remaining 2 days? That sounds like a terrible way of trading your time. And even if you think right now that you only need that one car or that big house or that new phone or X amount of dollar on your bank account and then you will be satisfied and happy forever – sorry, but this is not how our brains work. No matter what possessions you gather, you will become bored of it. Our brains are evolutionary trimmed to want more, no matter how much we already have. This is the reason humanity progressed that much, why we build big cities and explore, but it is also the reason why we always keep running after the next shiny thing.

I don’t say your goal shouldn’t be to make (a lot) of money. In fact you should, because even though money doesn’t lead to true happiness, being poor is much worse. Money can solve problems and let you sleep at night, and buying something nice from time to time is a refreshing short term high. But it is not worth trading a huge chunk of your life in for. Believe me, I did the mistake of doing something just for the money for a couple years, and I ended up feeling horrible. 

So instead of making money (or prestige) a priority, you have to find something that doesn’t feel like wasted life time to you. If you hate your job (or grow to hate it), 40 or more hours of your week are wasted life time. You probably wont find something that is super fun 100% of the time, but it should at least have a significant part that you enjoy doing. In todays day and age you can monetize almost anything, and more importantly, you can learn almost anything. If you can read this, it means you have internet and therefore access to an infinite amount of knowledge. The only thing that matters is a burning desire. 

Ok, so this part was not so much about motivation for coding, but to find out if there even is a point in working on your motivation. If you think programming is the right thing for you, then continue reading.

 

2. Adjust your mindset

The way you (actively choose to) see the world has a huge impact on how you feel. And how you see obstacles and drawbacks decides if you will thrive or collapse under pressure. This is a pretty big deal, because the same situation with the same amount of discomfort can be experienced in completely different ways depending on your mindset.

I didn’t want to call this part “Adopt a growth mindset” again, because I talked about that topic a lot in multiple blog posts already. So instead let’s talk about mindset in more general terms.

Let’s say you face an obstacle. It doesn’t really matter what kind of obstacle. Maybe you don’t understand something you’re trying to learn and you have to try extra hard. Maybe you have to work more hours than you are comfortable with. Or maybe you have to wake up extra early, sleep very little or do anything else that is hard but necessary to get you closer to where you want to be. You can see this obstacle just as something bad, in which case it will make you feel miserable and you will most likely try to avoid it in the future – you might even give up your whole plan. Or you can switch your view and see it as something that separates you from the people that are not willing to do what it takes. You can see the challenges as an opportunity to outdistance your competition. Everyone does what is easy, but very few people do what is hard. If you are willing to push through what is uncomfortable, it raises your value. With this mindset, all these hard challenges become opportunities to get to the next level and leave the rest behind you. You just have to remind yourself regularly and embrace it.

It might seem arrogant to view yourself as “better than others”, but a bit of a competitive mindset is healthy and will help you keep pushing forward. So nothing wrong with that.

Another important thing you have to realise, is that – the same as money – comfort and instant gratification don’t bring happiness. You would think that making your life as easy and as comfortable as possible would also make you happy, but if this were true, the general level of happiness would’ve exploded exponentially in the last couple of centuries. Did it? No. There are enough studies and graphs that show that society’s average happiness pretty much stays even over time. Also if comfort would equal happiness, our ancestors would’ve been depressed and suicidal all day, because their lives were pretty damn uncomfortable. And we wouldn’t have so many unhappy people today that live better than kings a few hundred years ago. 

I feel most happy on days where I worked hard on something that was important to me, even though it often was highly uncomfortable while I was doing it. Whereas I feel pretty bad on days where I spent my time procrastinating and wasting time, even though it felt good and relieving in the moment. There are different factors that play an important role for happiness. I am no expert so I don’t know all of them, but one is certainly some sense of progression and personal growth. Whereas I am pretty sure that eating a chocolate cake or watching tv shows 5 hours a day is not beneficial for happiness. You will never look back and think “That one day when I binge watched tv shows for 5 hours, that was amazing!”.

I’ve already talked about the “growth mindset” in a lot in different blog posts, so I don’t want to repeat it again. You can read about it when you click here. If you don’t know what a growth mindset is, make sure to read that blog post as well, because it is a very important topic and changing from a fixed mindset to a growth mindset is one of the most important steps you can do in terms of self improvement. However, if you are a gamer, my post about how to approach life like an RPG might connect more with you, because it combines the concept of the growth mindset with the playful approach of gamification. Just read the one that seems more interesting to you.

 

3. Get into the Flow

The name of this channel is not randomly chosen. “Flow” (also called “the zone”) is the state of being fully immersed in an activity, when time seems to fly by while you’re highly productive without pondering about the past or the future. You feel energized and enjoy the activity for what it is, without thinking about the extrinsic rewards. The task might be challenging but you know you can do it, and so it feels more like an exciting game than real work.

The reason the outer world and your sense of time seems to disappear when you are in the zone, is because when you are 100% focused onto something, your brain simply doesn’t have enough capacity left to process anything else. It doesn’t have enough “RAM” to worry about the future, think about what else it would rather be doing right now, or even notice appetite. Of course that’s the short description. If you want to know more details about the flow state, there’s a whole book about it written by psychologist Mihaly Csikszentmihalyi, which you can find when you click here.

Flow can drastically increase your long term motivation, because it makes hard work feel easier and more enjoyable. It is a very desirable state to be in and you should try to get into the zone as frequently as possible. However, to get into the flow state you have to make some preparations, because it can only occur under certain circumstances. Here are some tips on how to reach this state more often:

  1. Reserve enough time. It takes at least 15 minutes to start to get into the flow state. I wrote in one of my first blog posts that I don’t use the Pomodoro Technique for coding because it breaks the flow just when it is about to begin. The Pomodoro Technique lets you work in 25 minute sprints with 5 minute breaks in between, but I would not recommend using this technique for programming. Instead, work in longer stretches at a time. I prefer to code in 90 minute blocks, but if I feel like I don’t need a break, I just keep going.
  2. Block out ANY distractions. To get into the flow state you need to be fully focused on what you are doing. You have to be so focused that you eventually forget the world around you. This doesn’t work if you constantly glance at your phone or have a chat messenger opened. Put your phone away, close all unnecessary programs and browser tabs, put headphones on and focus exclusively on a single task. Also check my blog post about how to stay focused while coding.
  3. Set clear goals. To get into the flow state you must have some sense of progress. You have to know when you are making a step forward and you need some sort of immediate feedback. Getting rid of an error message in your programming IDE is such an immediate feedback that let’s you know you’re going into the right direction. The same is the case for running your program and seeing that something works that didn’t work before. The kind of feedback doesn’t really matter, but it has to be frequent and as immediate as possible, so you know where you are heading to and how your adjustments influence the end result.
  4. Make your task challenging. To get into the flow state your task’s difficulty level has to be slightly higher than your skill level. It has to be challenging so you don’t get bored, but it must not be too challenging, because then you will get frustrated. Boredom and frustration are both flow killers. Prepare your task in a way that takes all your effort and focus, but you still know you can get it done. Reading a book will probably not get you into a flow state, because it’s too slow and too easy. Whenever I try to learn exclusively by reading or watching a video, I feel like time is passing super slowly and I don’t remember much of the stuff I am reading or watching. But when I learn by practicing, by building things, by writing code, testing it, changing it, experimenting with it and just spending my time executing, time seems to fly by. And it’s time well spent, because I progress much quicker than by passively consuming content.

 

4. Make incremental, steady progress

The hard part about staying motivated over a long period of time, is the missing short term gratification. The search for short term pleasure is what makes people fail while trying to achieve their dreams. Procrastination is short term pleasure. Eating a chocolate bar is short term pleasure. Taking drugs is short term pleasure. All these things stay in the way of achieving long term goals.

I already explained that all these short term highs don’t bring happiness, but they are hard to resist nevertheless. However, you can compensate for missing short term gratification by breaking your big goal down into small steps, because reaching a goal in itself is a form of short term gratification. Think about the feeling when you tick off an important task on your to do list. Or when you finish some sort of project and hand in the result. Every time we reach a goal, no matter how tiny it is, a little bit of dopamine gets released in our brain and motivates us to do more.

Now, it’s easy to grill your dopamine receptors with video games, social media, drugs etc. because they also trigger your hunter gatherer instinct by releasing dopamine, but if you are mindful with these activities and only do them sparingly from time to time, you won’t get numb for the rewarding feeling of finishing something that actually required hard work. I don’t say you shouldn’t play video games, delete your Facebook account or never watch tv shows, I do these things myself. But just remember that the reward circuits in your brain are there to bring food on the table, not to get your magician to level 90. Be mindful and responsible when you do these things. Watch a TV show at the end of the day when you feel like you deserve it. Don’t watch them just out of boredom. The same goes for other leisure activities, but particularly the ones that are so highly addictive and lead to bingeing.

It’s all relative. If you eat candy every day, apples start to seem super boring and plain. If you have all the accomplishments of 3 life times in 1 gaming session of “The Sims”, real life seems not worth the effort. If you get rid of some of these artificial sources, your taste buds (and reward circuits) start to get more sensitive again.

So instead try to get your rewarding feeling from something that actually improves your life. Reinforce your productive behavior by making it feel as good as possible. Whenever you can, try to break down bigger goals into small bite-sized steps, it works wonders. It turns daunting tasks into frequent bursts of dopamine. Write these steps down and tick them off as you finish them. And  make sure you work on them regularly. A little step every day is better than big steps every couple of weeks.

For example, right now I have to prepare my website for the GDPR law. It’s a new European law where we have to be very careful what data we gather, and where we have to disclose absolutely everything. That’s good for you visitors, but for me this means a ton of work. When I think about this task as a whole, it’s huge, overwhelming and daunting. But instead I chunked it down into 20 minute work sessions once per day and planned them into my calendar. So I can just focus on these little blocks and when I tick one of them off my list, I feel satisfied, because I know I made progress on it. How much I have left to do doesn’t matter. The only thing that matters is that I did my focused 20 minute session today.

 

5. Just start

The last tip for this post, but a very important one nonetheless, is the following: If you don’t feel like doing something, just start. You probably heard that often, but that is because it works. You can’t always be motivated, but motivation actually follows action. You might have noticed that often when you just start doing a daunting task, you don’t want to stop anymore once you got the ball rolling. For this you don’t even have to reach a flow state. Right now as I am typing this I am experiencing it, because it is 10 pm and I also didn’t feel like writing on this post today. But now I am sitting here for almost an hour already and don’t want to stop typing. Please don’t fall for the trap of thinking that you have to be motivated to do something. Your motivation will betray you frequently and then you can’t wait until you “feel like it” again. At least not if you want to get something done.

So how can you make sure that you do what has to be done even if you are unmotivated? I tried different things and what helped me the most, is scheduling my work as blocks into my calendar. This way I know exactly when I have to do which task, and then I just start when it’s time, no matter if I feel like it or not. It’s a clear signal to start and helps me get over that initial barrier of repulsion. And from there it usually just flows. It also allows me to take planned breaks without falling into hours of procrastination and without feeling guilty for relaxing. I prefer 90 minute blocks (enough time to get into the flow) followed by a 20 minute break. If your work consists almost exclusively of programming, than you can even consider doing longer sessions. If you don’t like this level of planning you can also try to implement the 5 second rule into your life. It’s an interesting technique from the book “The 5 Second Rule” by Mel Robbins. Check it out if you can.

 

To summarize this post: Ask yourself if you want to be a programmer, and if the answer is “yes”, adjust your mindset, break your goals down into smaller steps, prepare your working session for the flow state and then just start, no matter if you are motivated or not. That’s the recipe for getting things done every day. Good luck and may you reach all your goals!

Related Post

3 thoughts on “5 Ways to Stay Motivated While Learning to Code”

Leave a Comment

This form collects your name, email and ip address so that we can keep track of the comments placed on the website. For more information on where, how and why we store your data, check our Privacy Policy.