DEV Community

Cover image for 7 Ways to Stay Motivated When Learning to Code
Codementor for Codementor

Posted on • Updated on

7 Ways to Stay Motivated When Learning to Code

Staying motivated is one of the hardest things to do when you're just starting out with programming. Programming is hard, so it's easy is to feel discouraged when you can't figure out why your code isn't working. You start struggling to wrap your head around complicated algorithms, or more advanced and abstract concepts. It can be really frustrating that progress seems like no progress at all.

To help figure out the best ways to stay motivated, I asked several experienced software developers about this topic, and here's what they told me.

I hope these tips help you in your journey as they did for me! 🙂

1. Make sure this is actually something you want to do

There are few things more frustrating than doing something that has no point in the end.

If coding is not something you want to do, then leave it to those who do. One of the first "learning hacks" for teaching yourself how to code is knowing why you’re doing this. When your code is in knots and nothing is going your way, those are the times when remembering your purpose for learning code will help push you forward so that you can stay motivated and ease any frustration that you may have.

Motivation is good, but not the answer to keep you going in the long run. Become passionate about what you do.

Sure you don’t need to be obsessed with all things code, nor do you need to be extremely passionate about coding from the start, Let's be real — these things don’t really happen overnight. It often comes after spending some time learning and understanding code, as well as creating simple things from scratch.

2. Start small, celebrate the little things, and build, build, build!

A good mentor of mine told me if you want to create a flying car, then start with making some wheels into a skateboard, enjoy the skateboard and turn that into a bike and so on.

Learning to code is super easy — said no one ever. Learning to code can certainly be a daunting task to many, but one of the most helpful ways to learn and stay engaged it is to start small. What this means is that you should first learn the basic syntax of the language, then start writing some code to practice. Once you’ve gotten a hang of it, go ahead and pat yourself on the back!

Take things one at a time so that you are focused on mastering bits of information or concepts. As you stack up those building blocks and celebrate those small wins, take a step back and you’ll see that you’re really onto something.

Build a personal low-risk project that tackles a new idea or puts a new twist on an old idea

Learning to code gives you the tools to build things that can potentially change the world. Build things, test what you’ve learned, and keep going at it. There are many resources available online to help inspire you, or, you can even join events like hackathons. Having a project, whether it’s all to yourself or with some friends, can be a great way to keep your drive. If you're stuck on what side project ideas, here's 40 to choose from.

3. Get a mentor

Get training or regular mentoring by an expert in the language of choice or technology you aspire to master

Most developers can probably tell you how much they’ve gained when learning from a mentor, whether it’s a senior colleague or even an acquaintance in the field. Having a mentor means avoiding those common mistakes and roadblocks that slow down your learning process. Mentors have all “been there, done that” and can provide invaluable advice and motivation taken from their real-world experience.

After finding that mentor, the possibilities for you to grow as a developer are endless. Make the most of your mentorship through pair programming, mock interviews, or even get a referral. Mentors are, without a doubt, the most reliable motivators that will guide you to the finish line.

4. Maintain a Portfolio

Once you’ve built more and more things, don't forget to keep a collection of your work. Whenever you’re feeling lack of motivation, you can always refer to this and see how far you’ve come. If you’re not quite sure what you should include in your portfolio, here's how to build a great tech portfolio and here’s a list of the most important things to include.

Don’t just maintain a portfolio for the purposes of finding a job though, you should be proud of what you’ve accomplished so far!

5. Just do it. Or just do nothing.

I try to keep in mind that the shortest distance between me and my goal is just to do the damn thing.

Sometimes, you just have to stop over-thinking and over-complicating things and just do it.

On the other hand, you can just “Do nothing about it. That’s right, forget about whatever is bothering you”.

Keep in mind that it’s easy to burnout after a few hours of binge-watching tutorials or non-stop programming. It’s important that you allocate some time for getting rest in order to recover, recharge, and reset.

And who knows, maybe you’ll even be able to solve the issue in your dreams! (Seriously though, it happens.)

6. Keep a good balance

​It can be easy to forget that there’s a world outside of your computer, so make sure that you’re consistently taking a break away from your computer (or even from electronics for that matter). Spending a ton of time on the same issue without making progress can easily lead to frustration, stress, and eventually, a burnout. Instead, meet up with your best buddies, spend some time with your family, or anything to get your mind off of whatever you’re working on, even if it’s for a few hours. Your brain will thank you for it.

Programming is a very introverted activity, so getting enough human contact can also be a challenge, especially for those people, like me, who were drawn to programming because they are themselves introverts. Making sure that I get enough social contact has been a challenge, so I started taking acting and improv classes.

7. Be a part of a supportive community

No matter what programming language you're learning, there's probably an online community out there for you. There, you can connect with your peers or developers more experienced than you that have been in your shoes before.

For beginners, I'd recommend CodeNewbie and freeCodeCamp are great places to start. There's also female-oriented communities such as Ladies Learning Code.

Lastly, there’s always Reddit (e.g. r/learnprogramming/), with subreddits for practically every programming language.


I hope these tips will help you maintain your motivation for programming, and maybe even help you motivate your peers. You can do it! 💪🏻

A special thanks to Rick van Hattem, Yad Faeq, Andy Maleh, Matthew Johnson, Marcos Rodriguez, and Christoph Wagner for providing awesome quotes.

This post has been updated and was originally published here:

How do you stay motivated? Is there anything that works or doesn't work for you? Let me know below!

Top comments (11)

codementorio profile image

Hello Nick! I'm part of the Codementor team but I'm not a mentor on the platform — my programming skill is not there yet 😅

Yeah, if mentorship is something that you're interested in doing, I'd definitely urge you to apply as a mentor and try out the platform yourself:

jonrandy profile image
Jon Randy 🎖️ • Edited

Since I started teaching myself programming back in 1983 (aged 7), it has consistently been interesting, rewarding, and fun - never once did it seem like a chore, overwhelming, or insurmountably difficult. I would suggest that if you are struggling to find motivation to continue, it probably isn't for you.

codementorio profile image

Yup, I totally agree.

rokkoo profile image

"And who knows, maybe you’ll even be able to solve the issue in your dreams! (Seriously though, it happens.)", me too!

Good post, in my opinion, when I blocked in on point for a time, I prefer to go out and then come to try again, this works a lot for me.

codementorio profile image

Nice! Yeah, stepping away from things and taking a break really helps. Glad you enjoyed the post.

kurakste profile image

Thank you for this. I'm learning node js now. It helps me. Can you give me an advise, where can i find a mentor?

marknathon449 profile image

There is a great new computer science service for learning NodeJS: FavTutor. The thing I like about them is that they select the best mentor or tutor for you, instead of your headache to choose one. You can tell them what you want and which topics you need classes with and they can set it up, here is

codementorio profile image

Great to hear that this post helped you! As mentioned in the post, there are lots of subreddits out there so I usually point people in that direction to start (e.g. /r/nodejs, /r/codementors, etc.).

If you still can't find the right mentor, you can consider Codementor's Node.js experts ( — please know that Codementor is a paid platform though.

Good luck!

codementorio profile image

Not a problem!

captainmoha profile image
Mohamed A. Farouk

Thank you for this, very useful and enjoyable.

codementorio profile image

Great to hear that. ☺️ Thanks Mohamed!