How to make programming a habit in your life
Tags: webdev, beginners, programming, productivity
Published: 2024-06-16 09:21:45

Hi Devs,

As a graduate developer trying to get my foot in the door of the IT industry, making programming a habit is crucial.

You need to consistently make commits to your GitHub, work on new projects with the new tech stack you learn, update your portfolio and so on! But I always think, *"Why did I end up scrolling on my phone all day? I've wasted my time again."*

Why is it so hard to make programming a habit and how can we change our bad habit into a good one?
&nbsp;
&nbsp;
### We first need to know what a habit is.

According to the Oxford Dictionary, a habit is a settled or regular tendency or practice, **especially one that is hard to give up.**

In his book, The Power of Habit, Charles Duhigg defines a habit as an unconscious action, such as brushing your teeth after a meal, grabbing a coffee before work, or biting your fingernails.

Habits consist of 3 elements:

1) **Cue**

First, habits are triggered when there is a cue that causes a person to act on a specific behaviour. A cue is an event that triggers a routine. It can be defined by time, an emotional state, a location, or an action. For instance, when boredom strikes, you might find yourself leaving your desk to look for someone to chat with.

2) **Routine**

Second, habits are formed by daily routines or actions that satisfy reactions to certain cues. For the example I explained above, the routine (a.k.a. action) is chatting with your colleagues.

3) **Reward**

Lastly, habits are followed by internal rewards that help people feel more at ease. The reward of having a chat with colleagues is feeling awake and more energized.

Here is a diagram to visually see how a habit works.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9spnrucr1eu0rxyclbhk.png)

&nbsp;
&nbsp;
### So, how can we change our habits into better ones?

Cue and Reward are more about internal feelings and reactions so by changing your routine to one that gives the same reward, you can easily switch the habits you hate into habits you are proud of.

For instance, instead of drinking coffee or eating snacks to stay awake, you can go for a walk or stretch your body. These will give you the same reward from the same cue and your brain will be satisfied as it is getting the same reward it expected. (Easy, aye?)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3wx658lnsrow7wvs4ll.png)

&nbsp;
&nbsp;
### I get all of that. How can we apply this to make programming a habit?

First, establish a regular cue, something you do daily, such as waking up, before lunch, or before going to bed.
Next, create manageable routines, such as coding for 30 minutes, learning AWS for 30 minutes, or solving a Leetcode problem.
The most crucial part of forming a habit is the reward 🏆! For instance, after coding for 30 minutes, you could make yourself breakfast or have a chocolate bar. Your brain and body will associate these rewards with the routines, encouraging their completion.

&nbsp;
&nbsp;
### Additional tips to make good things a habit

1) Plan your tasks in smaller pieces

If you have big tasks to complete, you will feel overwhelmed before even starting. Break them down as small as possible and cross them out as you finish them! You will feel a good sense of accomplishment.

2) Prioritize your work

Finish important & complex work in the morning, and complete creative work in the afternoon. People like Beethoven and Einstein, who have great achievements in history, tend to finish complex and time-consuming jobs in the morning and spend some time in the afternoon to recharge and do some creative jobs.

3) Work on something that makes you excited and interested

If things are what you truly enjoy and are interested in, it will become a habit very fast before you realise it. So find something that makes you excited and joyful.

&nbsp;
&nbsp;
Here's my summary of how to make programming a habit. I hope you found it helpful!

Maintaining a learning mindset during tough times can be challenging, but I believe consistent effort pays off.

Stay tuned for more valuable information soon.