How do I keep myself motivated when learning to code?
Tags: motivation, beginners, productivity, programming
Published: 2022-01-23 14:15:17

<small>Photo by <a href="https://unsplash.com/@drew_beamer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Drew Beamer</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a></small>
I get this question a lot from people who just started learning to code since most of them are not used to sitting in front of a screen wondering what went wrong with their code. Even if they just copied the source from the tutorial but still return errors, it is frustrating, at first everything seems intimidating from the concept.

![Photo by <a href="https://unsplash.com/@drew_beamer?utm_source=unsplash&utm_medium=referral&utm_cont#ent=creditCopyText">Drew Beamer</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
  ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mrwceyjef1w5w2w40cut.jpg)<small> Photo by <a href="https://unsplash.com/@drew_beamer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Drew Beamer</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
</small>

I remember well the first time I heard the word ‘Classes’

```java
class Cat{

  // state or field
  private int paws= 4 ;

  // behavior or method
  public void meow() {
    System.out.println("Meow, Meow, Meow");
  }
}
```

The analogy looked strange, and I didn't grasp how I was supposed to build the things I dreamed of making (websites, video games …)
Using the basics things I learned (variables, loops, classes …).
With all these struggles, you start losing focus and interest in coding. Unconsciously, you want to go back to your comfort zone
Where the comfort resides, the fighting soul inside you is trying to make you start over, but the laziness keeps crawling into your mind to procrastinate more and more.

![Photo by <a href="https://unsplash.com/@thelowedown?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Dave Lowe</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
  ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yv0f2ullcesbbd80bnh5.jpg)<small>Photo by <a href="https://unsplash.com/@thelowedown?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Dave Lowe</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a></small>

To fight that you can take many approaches: The extreme one I find beneficial. There is a quote that says:

> "motivation is bullshit, discipline is all that matters".

Being motivated is related to your mood, which is not that stable. Every day there is a new state to live in, this morning you woke up happily because you slept well, but it comes to your attention that you are late for this meeting that you have been waiting this month, so you get anxious while thinking of an excuse for being late, on the road the client calls you to cancel your meetings because he is busy, so you feel blissful. On your way back, you get a flat tire, which you will have to fix yourself.
The odds of these incidents happening the same day is low, However, emotions are not something you can be in control of; every event would trigger something in you: it can be either a positive feeling or a negative one. We as humans can only be in control of how we respond to these events, so we need to keep our emotions from our productivity.
Regardless of our mood, when there is a task to be done, discipline introduces itself as training for a particular behavior that will trick your brain into making the doing of this particular task an everyday habit. Our brains can be easily tricked, we are lazy by nature, just with different levels.
Daily habits are your comfort zone, you will never hear someone complaining about having to brush their teeth every day, buying groceries, or going to the hairdresser. It’s just work that should be done, Regardless of its nature, or its amusement.

![Photo by <a href="https://unsplash.com/@wadeaustinellis?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Wade Austin Ellis</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
  ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2dvhz8pn34uigf4qn1w0.jpg)<small>Photo by <a href="https://unsplash.com/@wadeaustinellis?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Wade Austin Ellis</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a></small>

Our minds are trained to perform consistently on an everyday task, better than a new task that is most probably going to procrastinate until you will forget about it. 
For this matter, the goal is to start manipulating your thinking that the new task is your everyday thing, it is what would make you a better version of yourself, and remember to reach the subject you need:
 **Discipline** and **Consistency**.

![Denzel Washington quote](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zraoc5xzenmdtwbgboz.png)