How To Build a Programming Habit

How do you become a successful software developer? Right now, you might consider making the step towards a professional career in software development. Yet, sitting down on Sundays for an afternoon to practice is not cutting it.
With practicing once a week, you basically start from scratch, over and over again. You need to re-learn syntax, compile and run code, what to do when something does not work, and break down a problem into manageable pieces.
The answer to this dilemma is building a habit, enabling you to learn and practice regularly.

Building Programming Habits

Software development is a discipline that requires daily practice. In fact, it’s similar to professional athletes, training every day. While they might spend several hours on the training court each day, we start with twenty to thirty minutes per day.
How do you feel when you read daily practice? Do you have thoughts like “I don’t have the time to sit down daily and practice.”?

If that’s the case, how important is this career change for you? Maybe it’s a hobby for now, and other things have more priority. Then, this blog post is not for you, and that is okay. However, if you want it enough, then there are some things to consider, and you should keep reading.

Writing Code vs. “I am a Software Developer”

The following thoughts are inspired and based on my learnings from Atomic Habits. You might have encountered thoughts such as ” I want to write more code” or “I’d like to be better at programming.”

Both are noble intentions. But let’s be honest, how many times each week do you sit down and learn? And is it easy to spend time learning? Or does it appear more like a chore?
Instead of focusing on your actions and the process, let’s talk about identity. If we just concentrate on writing code, it would result in a new habit based on outcomes (writing code). But, you don’t just want to write code; you want to architect software systems, devise new and innovative software solutions for unsolved problems. That’s what software developers do.

It starts with changing your beliefs. You don’t just want to “try learning how to code,” but you are a software developer. It’s a new identity separate from experience. Others might claim you can only be a software developer with so and so many years of experience. The truth is: There’s no law or regulation about it. Once you start writing code and solve problems, You are a software developer.
By assuming this new identity, a few more things happen as well:

  • A software developer writes code. Assuming the identity automatically results in consequence of writing code. The initial outcomes might not be satisfactory, but you’ll get there eventually.
  • You program your subconscious to attain a new goal (Becoming a successful software developer).

Being a software developer is an identity you assume, just like how I am taking the identity of a writer (to produce more content like the post you’re currently reading).

Building a software developer habit

Now, let’s examine how to start building a software development habit to support this new identity. If you read my article on “How to start writing,” the following sentences will seem familiar.
In Atomic Habits, James Clear describes the first step towards building a new habit by coming up with an implementation intention.

An Implementation Intention is a plan you make beforehand about when and where to act. That’s how you intend to implement a particular habit.

Clear, James. Atomic Habits. Penguin Publishing Group. Kindle Edition.

You might say something like ” I want to practice programming in the morning.” But would that start right after you get out of bed, before work, before lunch? Also, for how long? Therefore, we need to be explicit about the when and duration of this activity.

Here’s an example I use in the context of writing:

Once I made my morning coffee, I will sit down at my desk and write for 15 minutes before getting into work.

There’s a cuemorning coffee, and a defined timefor 15 minutes before getting into work. Both of these are crucial in determining when this habit will take place. For you, this could look like this:

After I made my morning coffee, I will sit down at my desk and practice writing a small program for 30 minutes, from start to finish, before starting my day job.

Now, it’s clear when this habit will start (“In the morning, right after making coffee,” “before starting my day job”), what will happen (“I will sit down at my desk and practice writing a small program from start to finish”).
If you work from home, this will be straightforward. If you commute to an office, keep reading.

How the Environment enables your habit

While a new habit starts with a clearly defined intention, the environment plays a massive part in the daily execution. An intentionally designed environment enables your new programming habit.

“By comparison, creating obvious visual cues can draw your attention toward a desired habit.”

Clear, James. Atomic Habits (p. 85). Penguin Publishing Group. Kindle Edition.

In a remote context: This could mean, before you go to bed in the evening, you put your personal computer on your desk, together with a handwritten list of topics you plan to look at in the morning. Your morning routine might include a shower, getting dressed, and making coffee. You can also bring your mind into the mood during these activities by listening to a short programming podcast.
The more cues you place in your environment that remind you of programming, the better.

In a commuting context: You bring your personal computer with you to practice while sitting on the train or bus. If you’re commuting by car, you leave a bit early and stop at a cafe on the way to work to get a coffee and get some programming time in. You might be stopping for coffee anyway, so you might as well go inside.

Another quote from Atomic Habits:

“If you want to make a habit a big part of your life, make the cue a big part of your environment. The most persistent behaviors usually have multiple cues. Consider how many different ways a smoker could be prompted to pull out a cigarette: driving in the car, seeing a friend smoke, feeling stressed at work, and so on.”
Clear, James. Atomic Habits (p. 86). Penguin Publishing Group. Kindle Edition.

While this is an example of a negative habit, it demonstrates how effective and enabling cues in our environment are. What are the places and times for you to place a signal to enable programming?

“Make sure the best choice is the most obvious one”

What to practice

You might be wondering what to practice in a 30-60min timeframe. Preparation is essential here. I suggest you sit down in the evening before to come up with a problem to practice the following day so you can solely focus on executing and learning the next day.

For instance, these could be trivial problems picked up from your daily routine, such as:

  • Ordering coffee at the local Starbucks
    • “Write a program that offers a list of beverages to order. The customer can choose one or more beverages from the list, and the program then determines the total price for the order.”
  • “Write a program that asks the user for their name and greets them with their name.”
    • “Modify the previous program such that only the users Alice and Bob are greeted with their names.”
  • “Write a guessing game where the user has to guess a secret number. After every guess, the program tells the user whether their number was too large or too small. In the end, the number of tries needed should be printed. It counts only as one try if they input the same number multiple times consecutively.”

Examples from here.

It might seem unintuitive or unfamiliar initially to write code to solve such a simplistic problem. The purpose of the exercise is to become familiar with the work environment (language runtime, editor, compiler) and the workflow (edit, compile, run) and break down problems and translate them into code.

Conclusion

While there’s more to learn on the road to becoming a successful software developer, it all starts with habits. Once the habit of writing code and practicing it is implemented, you can build on top of more elaborate strategies and advanced topics.

How do you design your environment to enable yourself? Share it in the comments below.

Additional Reading

If you found this blog post helpful, follow me on Twitter.

Leave a Reply