Peter's cartoon avatar

Peter O'Shaughnessy

Web technologies and browser-based experiments

Productivity Hacking for Developers

Cross-posting my article on the pebble {code} blog


Gordan was about five months in, working as a developer at a startup, when he started to hit the wall. He was always the first person to arrive at the office and the last person to leave, yet he seemed to achieve no more than the other developers. A couple of weeks earlier, he had started going to the gym regularly, in the hope it would help boost his energy levels. Yet, if anything he just seemed more tired; his productivity slump was worse than ever.

Gordan almost gave up on being productive, but he resolved to keep trying new routines. A couple of weeks later, everything had turned around. Through experimentation, he had discovered the right set of habits to ‘hack’ his productivity. He now had more energy, found it easier to focus, and was generally being more productive. (And a few months later, he got a new job with us at pebble {code}!)

Habits are more powerful than most of us think. A Duke University study found they make up 45% of our daily actions. Charles Duhigg has devoted an excellent book to the subject, uncovering how the right habits are crucial to success.

“There’s nothing you can’t do if you get the habits right.”
— The Power of Habit

As a developer, I’m intrigued by how transforming our habits can help us to write software better and quicker. Just think: boosting your productivity by even a few percent could leave you with significantly more time to devote to your family and friends, your side projects, or keeping up with latest tools and frameworks.

So how did Gordan hack his productivity?

As he revealed in his recent lightning talk, he started by analysing his existing habits. He used time tracking software to see what was really spending his time on. He found that, on average, he was only working productively for about 3-4 hours each day. The rest of his time was getting eaten up by various distractions, reading articles or procrastinating. This is far from unusual; most respondents to a Hacker News poll said that they are only productive for 2-4 hours a day.

By tracking how he really spent his time, Gordan had used a powerful technique. Just the act of recording something helps us to become more conscious of it. A National Institutes of Health study found that dieters who kept daily food records lost twice as much weight. As developers, we might recognise a parallel here with tracking our completed story points and conducting sprint retrospectives. It is only by recording and analysing how we are currently performing, that we can figure out ways to perform better in the future.

Having analysed his existing routines, Gordan began experimenting with time management techniques - defining specific time slots when he would try to focus, switching off from distractions. Initially he attempted 10 slots of 45 minutes, surrounded by breaks. Unfortunately this led to probably his “least productive day ever!” Why had it gone so wrong?

It’s clear that particular routines work better for different people. Pomodoro, a well-known time management technique, specifically defines 25 minute time slots. Developer/blogger Kevin O’Shaughnessy (my brother) finds that that 25 minutes is too short: “I can usually focus quite well on a task for up to 2 hours. Breaking after only 25 minutes seems premature.” However, for Phil Powell, CTO of Alertacall, the Pomodoro Technique - along with daily meditation - has given him “huge productivity gains”. His key to success? “Being strictly disciplined. It’s too easy to think: ‘just 5 more minutes’”.

As for Gordan, he found his ideal routine through experimentation. After trying a couple of variations, he soon found that one worked very well for him: 4 slots of 90 minutes per day. Following this pattern, he felt significantly more productive.

A second habit also made a big impact: his new regular exercise. It just took a little while for him to start seeing the benefits. This is common; it usually takes a few weeks for exercise to start making you feel more energised.

Exercise also has many other health benefits, such as helping you to feel less stressed. Not only that, it can often be a “keystone habit” - that is, a habit that has the power to start a chain reaction, helping other good habits to take hold. For example, people who start exercising often find it easier to start eating healthier food. In The Power of Habit, Duhigg explains how a couple of keystone habits - visualisation and relaxation - helped Michael Phelps to become the most decorated Olympian of all time. Once he had established those core habits, “all the other habits - his diet and practice schedules, the stretching and sleep routines - seemed to fall into place on their own.”

So time management and exercise were very beneficial new habits for Gordan, but he didn’t stop there; he discovered other techniques helped him too. Breaking tasks down into smaller chunks helped him to feel good about continuously achieving things. Making notes helped him to pick up where he left off and to process his thoughts (“like rubber ducking, but with yourself”). And changing his environment from time to time (working from home some days, or moving to a standing desk for a while) helped him to stay fresh and free from distractions.

Altogether, he felt transformed.


To introduce new habits, or to modify bad ones, it is useful to understand the Habit Loop. Habits consist of a cue, a routine and a reward. Thinking about the reward helps to form a craving.

Habit Loop

If we want to stick to a new routine (e.g. going for a run before work), it is useful to define the cue (e.g. our alarm going off) and the reward we get from it (e.g. the implicit endorphin rush - or perhaps treating ourselves to a fruit smoothie). Hopefully we’ll start to crave that reward and our motivation for this good habit will be sustained.

As for stopping bad habits, the bad news is that they cannot simply be cut out. But, like our code, they can be refactored. This is the “Golden Rule of Habit Change”:

“You can't extinguish a bad habit, you can only change it”.
— The Power of Habit

Habits are most malleable when we keep the same cue and reward, but change the routine. For example, if you have a habit of snacking in the cafeteria every afternoon, you might, upon reflection, realise that the reward you get from it is the social interaction. You could keep the same cue (perhaps it’s mid-afternoon boredom) and choose a better routine that gives the same kind of reward (for example, taking a walk to the water cooler).

Habit Loop 2

At my old company, Luis was always the first person in the office. While many of his colleagues were just waking up, he was already in the office, tackling the toughest problems of the day while his brain was most active. By mid-afternoon he would start winding down, switching to reading, or other less intensive tasks.

One day I asked him if he ever found it difficult to wake up so early. I was amazed when he told me “not any more, but I never used to be a morning person at all!”

Luis had adopted his early-riser habit in the US Marine Corps, where there was really no choice but to do so. The transition wasn’t easy; it involved placing alarm clocks further and further away from his bed to force himself into getting up (his new routine) when it rang (the cue). It also took a while for him to stop feeling sluggish in those early hours and to start feeling alert earlier (the reward). But sure enough, his new habit took hold; he had transformed himself from an ‘evening person’ into a ‘morning person’.

“This is the real power of habit: the insight that your habits are what you choose them to be.”
— The Power of Habit

As well as helping us to be healthier and happier, the right habits can help us to be more productive as developers. With a new year about to begin, it’s a good time to reflect on our routines and how we want to change them. By identifying our existing habits and analysing our habit loops, we can learn how to reprogram them. So who wants to join me in making some productivity-hacking New Year’s resolutions?

If you have benefitted from any particular productivity hacking techniques, please let me know. Happy New Year!

productivity programming