This is the second in a multipart series on building habits for software engineers. Part one can be found here.
Observing The Habit
As outlined by James Clear author of the book Atomic Habits, the first step to building great habits or replacing negative habits with positive ones is to first observe the pattern. Often, habits are so subtle and intertwined that it can be hard to notice them at first. Getting to the root cause of a habit helps to diagnose the cues and modify the response.
At every moment, information bombards the senses as specific activities unfold across space and time. It's difficult to suss out even the simplest relationships: does Matt grab dessert coffee on the way to work because he's tired? Is it because he expects to be tired? Maybe, just getting into his car triggers the habit.
One method to start changing behavior is to notice the most obvious habits that pattern daily life.
Take, for example, error handling. It can be tempting for software engineers to let their QA team catch all their code's edge cases and failure modes. Handing off to someone else after getting to a state of "works on my box" prevents engineers from fully understanding and owning their work product.
In the context of a big team, it's easy for new developers to avoid having to fully root out tricky bugs. They may feel pressured by daily or weekly deadlines, not wanting the axe of corporate blame to fall upon them.
With misaligned incentives that favor quantity over quality, engineers are rewarded for moving on to new things as fast as possible rather than thinking critically about what they're doing and learning to cope with and prevent common mistakes.
Though a habit like this can quickly spiral out of control, taking a step back and identifying the cues can be very helpful.
In this example, the cue could be something as small as how the office lights dim when it's time to go home, or an off-handed comment made by a colleague about how slow development is churning along.
Let's say Alexis is trying to figure out how to diminish the power this conditioned behavior has on her work. In the moment - just as she feels the urge to prematurely submit her changes - it would be helpful for her to be nudged to take a step back and introspect.
It can be helpful to think about a few of these questions... "Where am I?", "what time is it?", "what's my emotional state?", "who else is around me?", or "what action occurred directly before the urge set in?"
After doing this for a few days, Alexis will begin to see a common theme underlying the urge. The strongest cues will keep cropping up again and again in her analysis.
For Alexis, the biggest cue to hurry up and finish a change occurred whenever she heard the heavy footsteps of the project lead walking past her desk.
Breaking Down The Negative Habit
Now that the cue has been identified, it's time to break it down and replace it with a healthier one. By this point, Alexis has identified the habit itself and its direct cue.
There are two primary ways of dissolving the negative habit: removing the cue or changing the response.
Removing the Cue
It's common that individuals attempt to change their behavior by avoiding cues that make them crave a certain embedded behavior.
While this may work some of the time, cues can often be complex, overlapping, and interconnected enough to make it impossible to avoid the cue. Some cues may be so integral to daily life that they're unavoidable.
In this scenario, Alexis would need to avoid being in the room whenever her project lead walks around the room. However, this could adversely impact her relationship with the team.
Psychologists consider this avoidance, or negative conditioning, one of the least successful ways to change a bad habit.
Changing the Response
In order to shift the behavior, Alexis will need to respond to the cue with a different behavior that relieves the urge.
At first, it can seem nearly impossible to resist the sway of the cue. Once the individual is caught up in the cue, the response behaviors occur naturally.
To get the behavioral switch to occur, Alexis will need to plan activities in advance for whenever a cue pops up.
Imagine that Alexis jots down this plan: Whenever the team lead walks past my desk in the afternoon, I will implement another simple test case.
With this plan, not only has Alexis removed the potential for prematurely submitting code - she's replaced it with a behavior that has a positive effect on her workflow.
It may not work immediately. Sometimes, the urge to get things done will be too strong to resist.
Yet, when Alexis started to adhere to the plan, she noticed she felt much better about the day. She doesn't need to carry any lingering anxiety home that she's pushed off bigger problems for later. She may even understand the project more fully in a way that will serve her later on.
As the long term benefits start to outweigh the instant gratification of the negative habit, the behavior will start to change by itself without needing conscious intention.
Most importantly, this shift in behavior maintains the golden rule of the habit loop: the old cue and reward are retained, while only the behavior itself is modified.
Stacking Habits for Workplace Success
Changing habits is not only about rooting out negative behaviors. Through adding a new behavior to a pre-existing habit, it's possible to leverage the power of a cue to work even more effectively.
Habit stacking is a strategy wherein the individual groups together small changes into a daily routine. The key to successful stacking is to treat the stack like a single action rather than independent tasks.
Why is habit stacking so effective? As humans age, the number of neurons they have starts to decrease naturally due to synaptic pruning.
In order to support future learning, the brain has to build strong connections between things. The brain knows to drink coffee, take a shower, and drive to work every morning in large part because these behaviors are all strongly linked together.
Habit stacking is a way that a software developer can leverage these natural mental processes.
Here are some examples of effective workplace stacks:
After Marc pours his morning coffee, he decides to check for any pending pull requests in his team's GitHub repository.
Marc loves Dark Roast coffee and pours himself a cup every time he gets to work. The cue of arriving at work causes him to respond by grabbing coffee, which then acts as a powerful cue for him to check the repository.
Daniel has a somewhat confrontational relationship with his colleague, Paul. Before he heads to Paul's desk every afternoon, Daniel reminds himself of a reason why he is grateful for Paul.
Daniel regularly needs to visit Paul's desk for a five minute chat about the current team project. As he starts to stack this positive thought habit on top of his daily chat with Paul, Daniel is able to feel less dread about getting this daily task done.
These examples illustrate how habit stacking creates simple rules around future behavior. No matter how the strategy is used, it only takes selecting a powerful cue to use it for better habits.
Need a little nudge to help you build better software development habits? botany.io is a smart virtual coach designed to help software engineering and managers professionally grow and improve their skills.