Sometimes my friends ask me, “How long would it take for me to learn python?” or “Where do I start coding to get a job?”. I tell them that if they pick a language and stick to it, then maybe work on a project or two, they will be well on their way to being a capable programmer. Then, they might ask me some follow-ups like “How exactly do I start? What should I download? Where are tutorials?” and I will point them in the right direction. I then go about my life as usual and then check on them a week later. What happens?

They’ve given up! I’m so confused! How could it be that my friend was so excited to learn about programming but quit so quickly? The process of obtaining the software wasn’t hard (These days, sites like codecademy let you type code on the web), the beginner code couldn’t have been too hard either, so what went wrong? I ask them what went wrong and usually it’s something along the lines of “I didn’t have enough motivation” or “I just stopped after a day”. I stop and think about it for a while.

Motivate

Sure, it makes sense. My friends wanted to learn, but after a shoft while lost motivation even after they started. But this brings up an interesting question. How is it possible for you to learn how to code on your own if you keep losing motivation? The reality is that there is no way to magically keep a steady supply of motivation for you to learn, so what can we do? You hear stories about 16-year old geniuses starting companies with code they wrote from when they were accepted to MIT at 13 because they learned at age 9. But where do those people start?

To answer this question, we first need to look at some of the other underlying reasons why it’s hard to code without motivation.

It isn't fun

Basketball

Compare coding to a hobby such as basketball. How come there are people so excited to go out to the courts to play and learn to play ball or watch it on TV? The obvious difference is that basketball is (for many people) actually a lot of fun even if you are just learning. You can still play with other people who are just starting out, and you will have a good time. When you code, it’s typically alone in front of an IDE or some tutorial. When you remove that fun aspect, your incentive to learn drops dramatically. This is no surprise, but what can we do about it? Well some sites like CodeFights have tried to fix this by turning coding into a game, but generally this won’t work. One possible way to fix this is to get a group of friends to learn with you. The addition of other people could add a competitive element to your learning which might make it more enjoyable. However, don’t let another person’s success demotivate you. This leads me to my next point.

Failure is unavoidable

I understood programming very quickly and was able to get my first project full up and running in less than an hour thanks to the tutorial - said no one ever. One thing that all beginners have to understand is that there is literally no one who thinks programming a project is easy. Ask any professional with years of experience and they will tell you just how much they struggled. I myself took 2 hours just to get my first “Hello World” program up and running because the tutorial didn’t tell me how to fix the compiler errors. When I was making this blog none of the posts would show up because the dates were in the future. When I made my first website I didn’t realize you had to link your css file in your html header and wondered why nothing was working. And all of this is not even the tip of the iceberg. If you are in a group of programmers and they talk about some complicated project they are working on, you cannot let this demotivate you a single bit. Instead, think about how much they failed to get to where they are, and realize that you can do it too no matter how many road blocks you face in the moment.

Lack of (Immediate) reward

Snowmen

There is a pretty big gap in what a programmer does when he is a professional, and what he does when he is a beginner. Many beginners have to realize that the process of learning cannot happen over a week, a month, or even a year. You might want to get your big automated mobile app website function compiler running as soon as possible, but you can’t do it without learning what a for loop is. Typically, once you learn how to print “Hello World”, you are not impressed. In basketball it is fun to make your first shot slam against the backboard and whoosh into the net. In programming, you are greeted with text on a screen. If you are fast, you might be greeted with an image on the screen in a few days. The point is, you aren’t really immediately rewarded for your coding efforts, and your brain sees that and decides to become demotivated. After all, why would you do something if there is no positive reinforcement in it for you? An easy solution to this is to simply reward yourself everytime you hit a milestone. When you learn the basics of a language go out for dinner, when you understand how pointers work go ice skating, when you make your first website go get a massage. It’s a simple idea that can go a long way in keeping you focused.

Start a project

Website

A beginner might be tempted to do another tutorial after they finished the first one if they do not feel like they learned enough. To this I say, no. As soon as you finish your tutorials on a subject, I say you should jump right into a project. The main reason is that once you’ve started on something, you will typically feel uneasy if you let it go unfinished. As a result, you have a much bigger incentive to return to coding once you’ve lost your motivation. This will also teach you good future habits such as googling/using stack overflow if you don’t know how to solve a problem. In the end, you will eventually finish you project and give you something to be proud of.

Keep a portfolio

It’s a good idea to keep a portfolio of all projects you’ve ever completed because it becomes a great go-to source of motivation. To this day I feel an urge to program every time I look at my github repositories. It lets me look back at my work and say “Wow, I remember when I solved X with Y. I should’ve used Z instead”. It also gives you a more tangible reward for all of the work you put into learning.

Spend time with other programmers

People

If you want to learn programming, surround yourself with it. In fact, it is crucial in learning anything to surround yourself with people who are way better than you. When you’re surrounded with programmers and you really want to learn, you will see it for yourself. You will observe the way they solve problems, the way they stick to their work through hardship, the way they read documentation, and even the way they carry themselves in their daily life. When surrounded by people smarter than you, you can only get better. To this day I still look around me and see people who are better, and it makes me want to strive to become the best programmer I can be. It’s hard at times being the worst at something in the room, but find happiness in the fact that there is no where to go but up if you do this.

At the end of the day, you can have all the motivation in the world and still not be able to learn to code. At times like this its important to check with yourself: Why do I really want to learn to code? Do I even want to learn that badly? Because you will never be able to learn to do something if you don’t genuinely want to do it.