The Fear of Merging
Tags: productivity, programming, career, learning
Published: 2020-01-12 12:55:14

I used to be a heavy coffee drinker, but once I realised how bad that was for my sleep I quit... Only to find that I've become a heavy tea drinker instead.

Intrigued by my body's pull towards hot beverages I wanted to understand why. The bestseller book [The Power of Habit: Why We Do What We Do in Life and Business](https://www.goodreads.com/book/show/12609433-the-power-of-habit) helped me solve the first piece of the puzzle.

## The Power of Habit

In his book, the author explains:

> Habits, scientists say, emerge because the brain is constantly looking for ways to save effort.

> 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.

> This effort-saving instinct is a huge advantage. An efficient brain requires less room, which makes for a smaller head, which makes childbirth easier and therefore causes fewer infant and mother deaths.

(Please see the [How Habits Work](https://charlesduhigg.com/how-habits-work/) appendix from the book for a more detailed description.)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/9qajmrk7ze7sc6hdrrkp.jpg)

### Reverse Engineering My Habit
Clearly my routine was making a cup of coffee, and my reward was sitting down in front of my computer, hot beverage in hand, ready for more work.
But what was the cue for this habit, that in total occupied nearly an hour of my day? Newly aware of how the loop works I started paying attention to what made me put the kettle on.

## The Fear of Merging
The second piece of the puzzle came from an unexpected source. Struggling to write articles for my blog I reached for [The War of Art](https://www.goodreads.com/book/show/1319.The_War_of_Art) - a book about fighting procrastination for writers. Steven Pressfield, the author, writes:

> There's a secret that real writers know that wannabe writers don't, and the secret is this: It's not the writing part that's hard. What's hard is sitting down to write.

But us programmers are strange beasts, we tend to be the opposite.
We'll jump headlong into our coding, shunning planning and tapping furiously at the keyboard. And when our code is ready we present it to our colleagues for review. Once it's reviewed and ready to go into production... Suddenly we don't want it anymore.

Suddenly we feel a need to check Hacker News, our emails, or... Spend 15 minutes making a cup of coffee.

That's it! My cue! Finally, I realised that my cravings start after I've:

- Written an email and it's time to hit "send"
- Written code and it's time to create a pull request
- Got feedback on my pull request and it's time to merge it
- Wrote a blog post and it's time to publish it

In other words I procrastinate every time it's time to step out of my comfort zone and do responsible, irreversible actions that can potentially lead to social repercussions.

- An email may cause disagreement ("Sorry, but you're wrong")
- A pull request may reduce our status ("How could you not spot this bug?")
- Releasing code to production may subject us to anger ("How could you crash our app?")
- Publishing a blog post may lead to rejection (nobody reads it)

These are all primal fears stemming from our social nature. They used to save our lives (being excluded from the tribe meant certain death), but now they just get in the way.

I wanted to see what would happen if I stopped drinking both coffee and tea. I laughed out loud when I found myself pacing mindlessly in the kitchen one day. The code was ready and it was time for a release. The loop was still there.

## Breaking The Loop
Let's get down to business.

Every time you grab that cup of coffee you know what you have to do. You know why you put off doing it. And you know how good it will feel once you do it. So how can you overwrite your primal instincts?

There are a few easy to implement behaviours you can utilise to help you with that.

### Reduce The Friction
In [Deep Work](https://www.goodreads.com/book/show/25744928-deep-work) Cal Newport reminds us that:

> A now voluminous line of inquiry, initiated in a series of pioneering papers also written by Roy Baumeister, has established the following important (and at the time, unexpected) truth about willpower: You have a finite amount of willpower that becomes depleted as you use it.

You struggle with yourself every time you decide on what to focus on next.
_Do I work on A or B? Do I reply to my emails now or later? Where will I go for lunch today?_ All of these are decisions that deplete your willpower. The professional in you will tell you to work harder, while the energy saving instincts will tell you to rest.

To save yourself from that strain plan your day at the end of the previous one. The procrastinator in you will no longer be able to have his say, and you'll save yourself a ton of decision making the next day.

And after you do your planning stop thinking about work. At least consciously. The author continues:

> If you need to do a math calculation, only your conscious mind is able to follow the precise arithmetic rules needed for correctness. On the other hand, for decisions that involve large amounts of information and multiple vague, and perhaps even conflicting, constraints, your unconscious mind is well suited to tackle the issue.
>
> The implication of this line of research is that providing your conscious brain time to rest enables your unconscious mind to take a shift sorting through your most complex professional challenges. A shutdown habit, therefore, is not necessarily reducing the amount of time you're engaged in productive work, but is instead diversifying the type of work you deploy.

Let your unconscious brain work for a change.

### Redefine Your Tasks
What's easier: replying to twenty emails, or replying to one email?

Split up your work into small, easy chunks. Ones that will make you say: "okay, this next task is small enough, I'll just do one more and only then I'll grab a coffee". And after they're all done you won't even want your coffee anymore.

So instead of "Write Feature X" your task becomes a list:

- Write simple prototype
- Write tests
- Make code look nice
- Create a PR
- Get reviews
- Merge PR

Would you want to go for coffee now, if all that's between you and that nice fuzzy feeling of accomplishment is pressing the merge button? Or would you rather press it now, and enjoy the rest of your day guilt free?

### Increase The Punishment
You evolved in an environment in which humans died from hunger - your brain will always choose conserving energy over work if given the choice.

If there are no negative consequences of slacking then you will find new, creative ways to slack.

You can introduce negative consequences by increasing visibility. If you're perceived as slowing the team down you'll feel shame - your brain will want to avoid that!

Are daily standup meetings effective because they improve communication, or because nobody wants to be the one saying _"I browsed Reddit all day yesterday"_?

### Increase The Reward
Parkinson's law states that:

> work expands so as to fill the time available for its completion

Unless you live under a rock you'll occasionally read that if [a company introduces a 4-day workweek](https://www.npr.org/2019/11/04/776163853/microsoft-japan-says-4-day-workweek-boosted-workers-productivity-by-40?t=1575108994744) or [reduces the number of hours worked per day](https://onlinemasters.ohio.edu/blog/benefits-of-a-shorter-work-week/) productivity stays the same, or even increases.

If you allow yourself to finish work early, your brain will stop coming up with ideas on how to fill up time and rather will find ways in which you can finish faster.

## Reduce Your Push-To-Merge Time Automatically

With all these insights in mind I wrote a tool that automates some of these points.

[Code Dog](https://code-dog.app) will post a list of your team's open Pull Requests to a Slack channel.

The application is designed to:

- Identify blockers
- Identify next steps required to keep the momentum going
- Increase visibility
- Reduce reaction time

It supports GitLab and BitBucket. For GitHub see [Pull Reminders](https://pullreminders.com/).