Perfect code routine

How to create the PERFECT ROUTINE to learn CODE


In some of my previous posts, I have mentioned the need for a good routine when it comes to learning code. But I want to take a moment to explain why a good routine is so important, and how you can go about creating one, which you actually stick too!

I will start by letting you in on a little secret. I have tried and failed to learn code a number of times in the past. Yes, I am not perfect.

Back in 2013, I tried to learn Web Development, that flopped. Again, I had another bash with C in the sweet summer of 2015. Guess what happen? Yes, another failed attempted.

Then, at the end of 2016, when my darling little boy came along, and I thought I would have another try. I soon realized the demands of a baby would force me into creating a good coding routine out of necessity. Otherwise, I didn’t have a hop in hell of finding the time to actually learning code.

And if you want to hear all about that experience you can check out my previous post.

This experience made me appreciate the importance of a great coding routine. You can learn and achieve anything if you are consistent. Being consistent will turn the unnatural feeling of writing code into something natural.

Take learning to drive as an example, on your first driving lesson you feel out of place and have to think about every little detail; the steering, the pedals, the clutch etc. But when you drive all the time you don’t have to think about any of that, it just comes NATURALLY.

That’s what you need and that’s what consistency provides. And the best way to achieve consistency is to have a great routine!

So how do you create the perfect routine?

Assess your situation

Here’s a little warm-up exercise to get you started. Before you doing anything I recommend just taking a brief moment to assess your situation and reflect. By that, I mean addressing the things that may stop you from achieving your goal. Because these are the things that may throw you off your routine.

Background vector created by Dooder -

Take a moment to think realistically about the hurdles you may face, or even better, have faced in the past. Can you pick out anything that has or may cause you to fall off the wagon?

The reason I ask is that if you can identify, anticipate and accommodate for those initial hurdles you will be in a better starting position. In addition, it will also help you to build a routine that works for you.

As an example, if I look at my situation my biggest constraint is time. Working full-time and becoming a new dad saw my spare hours dwindle to basically zero. So I had to factor in my available time, this really forced me to think about when I could actually study programming.

You don’t just have to consider environmental factors, also think about yourself personally. Ask yourself how do you learn best? Do you need visual tutorials for example?

By asking these questions and taking a brief moment for self-reflection you are priming yourself for the very import next step. And that is your plan of attack!

Create your plan of attack

I can pretty much guarantee you that any successful person in history had a plan for how they are going to achieve something. Whether it was a detailed document or a mental plan, they all have a clear vision for reaching their goals. That includes creating a great routine.

For the purpose of this post, I want to focus more developing a daily schedule, rather than a long-term plan.

However, I would strongly recommend having an overall plan for learning code. Something which sets out your high-level aims and objectives, and details how and when you plan to meet them. Plus any resources you intend to use. For me personally, just saying “I am going to learn code” didn’t cut the mustard as it didn’t provide any real structure. So I kept straying!

Your plan doesn’t have to be detailed, it just needs to provide structure, value and a clear vision. To help you build one I suggest checking out my post, The SECRET to starting your programming journey RIGHT

Back to your daily schedule…

At this point, you should have an idea of your various constraints and commitments, and you can start building a scheduled to work around them.

You can use various tools to help you create a schedule. You can opt for the basics of pen and paper, use your Google calendar, or even opt for an app such as You may even just decide to keep to a mental scheduled. It really does depend on you.

Although, for the start, I would recommend creating something physical. Just until you cement your routine. For me, it was kind of a physiological thing. I discovered writing out my schedule made me more committed to it because it was something real and tangible to follow.

How you choose to create your schedule is up to you. If each day looks exactly the same you may not need all the bells and whistles, and a simple solution may suffice. But if you lead quite a complex life something more robust may be in order.

Of course, if you love technology, you may look for any excuse to use an app. I will say that tech has the added advantage of setting reminders and alarms, which serve as great prompts. Something good old fashion pen and paper can’t do.

Actually creating your schedule is fairly straightforward. You essentially just want to assign time slots to different tasks and activities you need to carry out each day or evening. If you need a guide feel free to have a look at my daily schedule.

Some quick tips to keep in mind…Be realistic with your time….And think long term.

You want to aim for consistency so don’t try and sprint to the finish. You will just be left burnt out and your routine will go down the pan.

Rather aim to do little and often, this will maintain your routine and also help build your programming knowledge. The worst thing you can do is leave gaps in your learning.

Full-time work and dad life means I am somewhat limited by what I can commit. And I have in the past pushed too hard with disastrous consequences. So I know the importance being realistic with your time. Getting there, in the end, is better than not getting there at all.

Finally, make sure to schedule downtime and fun. You need to give yourself opportunities to re-energize in order to stay productive. It also gives you something to look forward to. By actively scheduling downtime you allow yourself the tools to disconnect when you need to and remain focused when work needs to be done.

Make coding a HABIT you do every day!

It’s all well and good creating a plan but the real issue comes when you have to stick to that plan! So, how do you do that exactly? Well, it’s simple, you just need to turn coding into a habit.

Habits are natural acts that we carry out without having to put too much thought into them. And that is precisely what you want when you’re learning to code. You don’t want to waste too much willpower just trying to force yourself to the computer. Because really, you’re going to need that willpower when your code won’t run.

By turning the act of sitting down and writing code into a habit you will make your routine easier to stick to, simply by turning it into a natural process.

How to building habits

On the basic level, habits are created through repetition. By doing the same thing over and over again it will eventually become a habit. So the first thing to embarrass is the mantra “code every day”.

This alone is probably the best piece of advice for a beginner. Not just because it will help build the habit but because the best way to learn anything is through consistent repetition.

Now the idea of coding every day may seem daunting. But don’t worry, there is a way to automate the process through the power of habit itself.

When I first started learning to code I read “The Power of Habit by Charles Duhigg” This book was recommended by so many people, who boasted its ability to build positive habits. So I gave it a try myself.

It offers a very simple explanation of how habits actually form. In essence, there are 3 key stages, which create a loop that nurtures a habit. When you understand these stages it will ease the task of building your own habits.

  1. The Cue – A trigger that tells your brain “its go time”.
  2. The Routine – The physical act or behavior that follows the cue aka learning code.
  3. Reward – A positive stimulus that tells your brain “this is good, I want more of this”.

For me, my cue begins with me making a cup of coffee, plugging my headphones in, and doing a quick home workout. I guess you could argue that the cup of coffee is the cue, but this is all something I do in preparation so I like to lump it together.

The music puts me in the right frame of mind, and I find doing a workout takes less mental energy compared to coding so its easier to start my evening here.

My workout can be as simple as doing some push-ups. It’s just something to get the blood pumping. I find it fires me up, which is handy on those nights when I’m about to fall asleep on the sofa.

Next, is pretty obvious, I head over to my desk and get to work!

Finally my little reward. Appart from the satisfaction of a productive evening, I reward myself with a couple of biscuits. Yes, you read right, biscuits!

I am a bit of a biscuit fiend. I know it may not be the healthiest thing. But hey, I just did a workout so I am sure I can spare the calories.

For me though the big secret is music. I find music can change my state of mind. If I’m feeling particularly low energy than a great high-energy tune helps.

I suggest you have a little think about the cues and rewards you can put in place that might help build your habits.

Be aware that sometimes you do just need willpower. But hopefully, you will find building cues and rewards will make it a bit easier.

Have a designated workspace

This might seem trivial and you may think it has nothing to do with actually building a routine, but I have personally found having a designated workspace makes a world of difference.

Designed by FreepikIt really helps me to “get in the zone”. Maybe it’s a psychological thing, but when I am at my desk I mean business. I know that’s the place where work gets done. I struggle to focus working from the sofa or anywhere else. It’s just not the same.

Particularly when you have a child I feel this is a crucial detail. I love my little boy but I’m sure other parents can sympathize when I say, kids take over your home!

Honestly, sometimes it can feel like Toy’s R Us has just vomited all over our living room. It can feel a bit chaotic and overwhelming at times, especially when you’re living in a less than spacious flat.

So for me, having a little corner of the room that is my little domain is important. There I can focus.

You need to create your own programming domain, a designated “code den”. Technically this can be anywhere you feel comfortable, productive and able to work.

However, I’d would NOT recommend somewhere too comfortable, like a bed. If like me, you’re going to be grinding away at night, you’re almost guaranteed to fall asleep mid-code.

I’ve been there. I innocently thought nothing of it, until I fell asleep without realizing, and was woken up by a warm sensation on my leg. No, not what you’re thinking, I was just spilling my coffee. But I was lucky none went on my laptop!

One last piece of advice, tidy and prep your workspace at the end of each session. 

I am not saying it has to be spotless, but it should be ready for you to be able to sit down and go the next evening. You don’t want to look over at your desk and think, “I’ve got to sort all that before I even start”.

Don’t create work before work.

The idea of having to spend time tidying and sorting before writing even one line of code is enough to put some people off. So just avoid it, and take a moment to prep your workspace for the next day. You have already done the hard job, this is a fairly easy and mundane task by comparison.

Minimize distractions

One of the big factors that can dismantle your routine is distractions. They are deadly!…to your routine.

Have you ever found yourself thinking, “I should have started an hour ago, ah well, what’s the point now, it’s too late”. And what do you suppose this biggest culprit is? MEDIA CONSUMPTION.

To be more specific, your TV, phone, tablet and games console. You probably don’t need telling that these gadgets are major distractions. An hour can fly by when you’re having a Netflix binge, scrolling through Facebook, or playing the latest online multiplayer.

Before I go any further, I am not saying you have to get rid of your phone, bin your games console or cancel you Netflix. You just need to minimize.

When your routine starts and your in “work mode”, go around and minimize those distractions. Turn off your TV, shut down any distracting tech, place your phone on the other side of the room. Just try to be proactive about removing and limiting temptation.

Don’t worry, I’m no saint! And this is still something I am trying to perfect. My biggest distraction is my phone, and like anyone else, I’m guilty of mindlessly scrolling through social media when I should be focusing. But I am getting better, and now I try to actively place my phone away from me.

However, my struggle comes when I want to listen to music because normally I use my phone. To work around this I have recently started listening through my laptop. That brings me to another distraction…THE INTERNET!

Luckily there are tools that can help. One I would suggest is StayFocusd. It is a Chrome browser extension which allows you to temporarily block yourself from any website. You can configure it to block certain sites and pages, as well as set a time limit.

Set an alarm

This one is really just a quick tip that might help build your habits.

Designed by FreepikIf you really struggle to get yourself in gear when the clock strike “work-time” try setting an alarm. Something loud and annoying that’s going to make you take notice. If it can get the adrenaline pumping already, great!

Having an extra nudge to get you started may just give you the kick you need. And it can also serve as a very useful cue to start your routine.

Although, just like the morning alarm it can be very tempting to hit the “snooze” button. To overcome this temptation you’re going to need some of that all-important willpower again.

You may find after multiple alarm bells you have cemented the habit and you can do away with the alarm. But it is really up to you. If you find it helpful and it doesn’t make you want to throw your phone across the room, then keep it.

My routine

I have waffled on about creating YOUR routine, but what about MINE?

Like many aspiring programmers learning to code, I currently work full-time in a job which is NOT related to programming. This means my coding routine has to be an evening one. And the real routine tends to start at 9.30pm.

Usually, by the time the baby has been put to bed and me and my wife have had some dinner it’s 8.30pm. Then I normally take an hour to wind down with my other half before I get to work.

Evening schedule:

  • 9:30pm – 9:45pm – Quick Workout
  • 9:45pm – 10:00pm – Read
  • 10:00pm – 11:30pm – Code
  • 11:30pm – 12:30am – Blog
  • 12:30am – Bed

This is the routine I set for myself and try to work to every single day. It does have some flexibility, I may swap over “Coding” and “Blogging”, or dedicate more time to one or the other depending on importance.

For example, if I feel I have neglected my studies and the blog is under control, I may spend more time coding vs blogging one night.

It’s important to know that this is a guide, while it’s what I strive for, every day may not be exactly the same. I may go for a run instead of a work out, I may read for a little longer or a little less, I may get so engrossed in code that I stay up passed 12:30am.

Then you have to factor in the unpredictability of a baby, who has no regard for my routine.

The important thing is to do the same stuff every night. That’s how your routine gets wired into your brain.

When your a parent and time is so tight I think it’s import to realize that you may not be able to stick to your times every night exactly. While I recommend setting times (just so you have a guide), don’t be discouraged if you can’t stick to them. Just keep hammering away until you find yourself doing the same things every night.

At the end of the day, as my good buddy Einstein so eloquently put it, time is relative. It doesn’t really matter if you start 20 mins late, as long as you follow your routine.

Like everyone, I have bad days and sometimes I may push myself a little too hard. But when this happens I take an evening to step back, prioritize and focus on completing the essential tasks. Then ultimately try to make sure I get an early night to recover.

I personally strive for a productive yet balanced life.


For me I think a successful routine comes down to 3 factors:

  • Planning – Having a clear vision of WHAT to do, HOW to do it and WHEN to do it. And proactively planning for breaks and distractions.
  • Environment – Building environment conducive to productive work. Somewhere you can feel “in the zone”.
  • Self-discipline – Instilling good habits, removing bad ones and trying to develop the willpower to help you push through distractions and procrastination.

Sharing is caring!

About the Author Owen

Creator of Code Dad, father and self-taught programmer. My mission is to balance life, work, family, all while learning to code, and hopefully help others who want to do the same.

follow me on:
1 comment

Comments are closed