DEV Community

Cover image for How to Make Programming a Daily Habit
Gaël Thomas for HereWeCode

Posted on • Edited on • Originally published at herewecode.io

How to Make Programming a Daily Habit

Coding is the topic of these past years. A lot of people want to start programming and become a developer. How can you develop a coding habit?

A few days ago, I started to read "The Power Of Habit" by Charles Duhigg. This book makes me think a lot about why people are struggling at daily programming. I think it's because of the habit process. Most people don't know how it is working and need concrete examples.

In this article, I'm going to explain to you what a habit is and give you some advice to help you create a daily programming habit.

What is a habit

Before starting, it's essential to define what is it and what are the components of this process.

If we check the definition of the word "habit" on Google, we find this:

"are routines of behavior that are repeated regularly and tend to occur subconsciously" ― Wikipedia


"a behavior pattern acquired by frequent repetition or physiologic exposure that shows itself in regularity or increased facility of performance" ― Meriam-Webster Dictionary


"a recurrent, often unconscious pattern of behavior that is acquired through frequent repetition" ― The Free Dictionary


"something that you do often or regularly, often without thinking about it" ― MacMillan Dictionary

As you will have understood, a habit is an automatic process in your life. Take brushing your teeth, for example.

It's interesting to define the components of a habit to understand how it is working.

Each habit includes three components: a cue, a routine, and a reward.
The Habit Loop

What is the cue

The cue is the event in your life that make you trigger a habit. Every time you make something automatically, it has been started after a signal.

Most of the time, a cue is defined by time, an emotional state, a location, or an action.

For example, I'm working when suddenly I smell the coffee from my colleague. My habit "Taking a coffee" is triggered.

What is the routine

The routine is what you are doing while the habit process is running. You can define all that you want in this part. As I said previously, it can be: I'm going to take a coffee.

What is the reward

The reward is the final element of the process. That's kind of what this routine has done for you. For the coffee example, the reward can be: Thanks to the caffeine, I feel less tired, and I am more dynamic.

The more the reward is positive and pleasant for yourself, the more your brain will save the habit.

"This process within our brains is a three-step loop. First, there is a cue, a trigger that tells your brain to go into automatic mode and which habit to use. Then there is the routine, which can be physical or mental or emotional. Finally, there is a reward, which helps your brain figure out if this particular loop is worth remembering for the future. Over time, this loop—cue, routine, reward; cue, routine, reward—becomes more and more automatic. The cue and reward become intertwined until a powerful sense of anticipation and craving emerges. Eventually, whether in a chilly MIT laboratory or your driveway, a habit is born." ― Charles Duhigg, The Power of Habit: Why We Do What We Do in Life and Business

A little exercise

I give you a little exercise to do, take one of your daily habits and try to define the cue, the routine, and the reward. Once you did it, you're ready to read the next part on how to create your daily programming habit.

How to make programming a daily habit

All you have to do to make programming a daily activity is to create a routine.

You are free to define what you want for each part of a habit, but I will give you a few tips to help you.

For the cue, you can try to define something based on time:

  • Every morning right after I wake up
  • When I come back from my daily work
  • At my lunch break
  • [Insert a time-based cue]

Routine will be our most straightforward element to define. You can just say, I want to code for 30 minutes, or I'm going to learn [Insert a skill] for 30 minutes, many more.

Finally, one of the most critical parts will be the reward. As I recommend in the first part of my first productivity article, you need to establish goals for yourself. It's going to help you to define a reward. Every time you accomplish your habit, you are closer to your goal.

Try to determine a long term goal, and inside of it a lot of small goals.

For example, you can say:

  • I'm getting closer to my goals for the week.
  • I'm getting a little closer to my final goal.
  • If your code right after you wake up, I make myself breakfast as a reward.
  • [Insert a reward]

A challenge that can help you

One of the best ways to get into a habit is to follow a 100DaysOfX challenge. This challenge is designed to help you create a pattern and commit to it every day by sharing what you did on Twitter, Instagram, or your blog.

The reason I'm telling you about this challenge is that it became famous on Twitter by the 100DaysOfCode.

I strongly recommend that you read the rules on the site and get started. You'll see, at first, it may seem big and impossible, but you'll find it fun to do so.

Besides, you will most certainly get support on Twitter, which will motivate you.

"Are you passionate about self-improvement? Eager to change your habits, have tried to do so many times, but had difficulties changing them? Life always seems to get in the way, there is not enough support, and you feel like you're alone in it? Find yourself thinking, "What's the use of all this self-improvement if I always seem to go back to where I started from?" ― 100DaysOfX

If I recommend this challenge to you, it's because I'm doing it. I'm thrilled with the results, and I'm only starting. For my part, I'm doing the 100DaysOfReading challenge. I always wanted to start reading but I never took the time to do it. Thanks to this challenge, I'm on day 17, and I finished one book and half of another one.

My habit loop:

  • Every time before lunch or before sleeping if I haven't had the time (the cue).
  • I read almost 20 pages or more (the routine).
  • I am approaching my long-term goal of reading daily. I am close to my short-term goal of finishing the book. It makes me happy because I have always wanted to read daily. (the reward).
  • I publish a quote from the book I'm reading with some explanations and motivational text on my Twitter (the commitment).

Some points that can help you to create your programming habit

Plan your tasks

To work every day and achieve my monthly goals, I plan all my tasks the evening before. I put on paper what I want to make, and every time I do it, I'll scratch it off my writing. I recommend you to do this with your daily programming habit because it's going to motivate you and satisfy you a lot when you finish all your goals.

If you need more structure in your work, you can define: what you are going to do, how, when, and why.

For example, I'm going to create a landing page for my website (what I'm going to do). I will use Vue.JS to build it (how). I will do it between 8am and 10am (when). It's going to help me better understand Vue.JS and help me to start getting the email of my visitors.

Code your dream project

What could be better than coding daily while working on the project of your dreams? If you need motivation, it's an excellent way to do programming every day. Don't be afraid to take the initiative. Doing it a little bit every day will motivate you even more and give you results in a short time.

Find the subject you want to work for

The world of programming is vast: web, software, AI, embedded, and many more.

One of the significant difficulties is to define what you want to do as a programmer.

It's not easy for everyone, but choosing a topic and stick to it can be a good motivation factor to practice daily.

For example, if you choose web programming, you can just focus on it. Even if it stays a big topic, you removed the software, AI, embedded, and others. That's a good start.

To go further, you can choose between the front-end and back-end.

I'm telling you all this because often, when you start, you get demotivated fast because there are too many things, and you can't focus on a specific theme.

A good environment

Something that can motivate you in your daily programming habit is a pleasant working environment. I do not recommend to work in your bed. You're going to be tired easily.

Try to work on a desk or a table and do whatever you need to feel comfortable in that space. It will make you want to work more efficiently.

Further reading

If you are interested to know more about the habit process. I invite you to read "The Power of Habit" by Charles Duhigg. This book helps me a lot to create this article and a lot of examples I gave you are inspired by it.

I've also heard about "Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones" by James Clear. This book is going to offer a framework to improve your daily habits. The author tried to provide a kind of practical guidance on how to make changes.


If you want more content like this, you can follow me on Twitter, where I tweet about web development, self-improvement, and my journey as a fullstack developer!

Top comments (2)

Collapse
 
jmvallejo profile image
Juan Manuel Vallejo

Nice article, I have a similar problem with reading where I want to do it more but just can’t focus or commit to it. This gives a bit of structure to that goal. Thanks!

Collapse
 
gaelgthomas profile image
Gaël Thomas

Thank you!
In this case, you should try the 100DaysOfReading challenge. I made a habit of getting used to it quickly. Today I feel "bad" when I don't read a bit in my day.