2-Minute Rule to Become a Master at Coding — Atomic Habits

Halim Shams
6 min readJul 4, 2023


An Article by — Halim Shams

Have you ever started watching an online video tutorial and, in the middle of that video, the tutorial becomes boring for you? Or you always tell yourself that this time you’re going to finish an online course, but when you sit down and start learning, it feels like any other tedious task like washing dishes and laundry. And at the end, you find it impossible to stay productive and make progress.

The question is: “How can I stay motivated when learning to code?

That’s when Atomic Habits by James Clear comes in. If you haven’t heard about this book, you probably aren’t into self-improvement books by any chance. In this book, James Clear answers questions like, What is a habit loop? How do I prime my environment to make progress on my goals? and How do I use Dopamine spikes to stick to good habits?

By answering these questions, I will show you how you can build the revolutionary habit of learning programming.

Let’s delve in…

Imagine a plane taking off from Los Angeles for New York. Just before takeoff, the pilot changes the flight path by 3.5 degrees, which is trivial. It is such a small change that nobody in the place can notice anything. When the plane lands, the passengers find themselves doing a sniff test because they are walking on the clean streets of Washington, DC, instead of New York. The point is that very small changes can entirely change the trajectory of our lives. And just like the passengers, we do not see the immediate results of these changes, but in the long run, the combined effect of these tiny changes and the final outcome can be significantly different.

As a novice programmer, you would think that you need to build something revolutionary to make it into the tech industry, but in reality, all you need to do is take small steps toward your goal everyday and you will be there before you even know it.

If you keep scrolling Instagram or watching YouTube, you will be no better programmer than today in one year. Build tiny atomic habits that help you learn programming everyday and you’ll be very close to landing that Software Engineer job in one year, beyond the shadow of a doubt.

Building habits is easy, but sticking to them is where most programmers struggle and can’t stay consistent. When you start to learn programming, you expect to see a linear improvement, but here is what actually happens:

Graph indicating the reality of making progress

At the beginning, you’ll not see any results. James Clear calls this part of the graph “The valley of disappointment”. This is where most people lose motivation, give up, and go back to their old habits. But in reality, the returns for your efforts are actually delayed. Once you pass this “Disappointment phase”, you’ll feel like a superhuman. Learning a new programming language, building projects, and getting into various jobs will suddenly come naturally to you. And when you look back at the first piece of code you wrote, you’ll definitely laugh at yourself.

Exclusive for My Blog Readers!

Are you always on the lookout for the latest tips and tricks in web development? Look no further! Sign up for my weekly newsletter, where I share short trending articles about web development tips and FREE tools and resources that are currently trending. Plus, I’ll throw in some exclusive content that you won’t find anywhere else! Subscribe now and join the community of web developers who are always one step ahead.

Get ahead in web development with our weekly newsletter. Join now!

Building Habit

To build a habit, you first need to understand the concepts of the “Habit Loop”. The habit loop contains Cue, Craving, Response, and Reward. That’s the loop that builds any good or bad habit that we repeat over and over again.

The Habit Loop

Let’s understand the Habit Loop by illustrating a bad habit we all suffer from. Your phone is next to you and vibrates (Cue), you crave to see who the notification is from (Craving), you pick up the phone (Response), you spend at least 30 minutes scrolling Instagram (Reward).

Or imagine that you feel bored with the video tutorial (Cue), you want to see something entertaining (Crave), you pick up the phone (Response), you watched entertaining MrBeast videos for another hour (Reward).

Soon, your brain starts making connections between watching YouTube and getting bored with the tutorial. And you end up building the bad habit of wasting time during your programming sessions.

The same way you can use the same Habit Loop to build decent habits, you can use your own laptop as a Cue to learn programming. James Clear mentions this in his book: You should make your Cue obvious by placing it where it catches your eye every time.

Cue alone cannot be sufficient; you also need to use Implementation Intentions to your advantage. Studies have shown that the main reason most people don’t stick to good habits is not because they lack motivation but because they don’t have clarity about what they want to achieve. When you say “Tomorrow, I will learn programming”, it’s just a stupid dream that has no clarity. So, instead of just saying that, use the Habit Stacking methodology. Next time you decide to learn programming, don’t just say, “I want to learn programming.” Instead, stack it with another task, like, just after brushing my teeth, I’ll sit down and write code for 2 straight hours. This powerful process is called habit stacking.

The 2 Minute Rule

To build the habit of programming sufficiently, the 2-Minute Rule will get you there. When you set unrealistic goals for yourself, it becomes tough to stay motivated to work on them.

Make habit building easy by taking small steps every day. — James Clear

James Clear recommends starting with only two minutes a day. For example, if you want to build the habit of reading books, you can start by reading for just 2 minutes a day and gradually increase the number of minutes in the process.

The same goes with the programming, you’ll NOT become an expert programmer overnight. Instead of watching the entire 40+ hour course in 2 days, try to get the most out of it by watching a single video of it and then implementing what you’ve learned. By doing so, you’ll prevent frustration and build a long-term habit of learning new things efficiently.

That’s it for this article. I hope you enjoyed it and learned something new from it.

Don’t forget to share it with the community, too, so they can also benefit from this context.

Don’t forget to subscribe to my exclusive newsletter just for My Blog readers: 👇

— You can follow me on Twitter as well, where I’ll share short and incredible stuffs out there, so don’t miss those. 🚀

Buy me a Coffee



Halim Shams

I Write about Programming and All the Related Content 🚀 I'm a Self-Taught Full-Stack Developer 💛