There is a pattern that almost all coders experience when they sit down to code:
- Ramp-up time – the 10-30 minutes it takes to remember where you were, get your head wrapped around the code you are working on, and get up to full speed.
- Productive coding time – This last from the moment you are wrapped up until either you get interrupted, or anywhere from 2-4 hours later when your mind is done.
- Non-productive coding time – The rest of the day when you keep trying to get back to full speed, or have not yet realized that you need a break.
The exact amount of time that all takes varies by coder, but almost nobody I know runs 8 hours in step #2. Yet I know many developers who code at a screen for 8 hours and call that their workday.
I optimize this process, by taking frequent breaks and thinking through questions I have with the code in the back of my mind. So when I sit down to code, I have a quick ramp-up, code through my questions, and typically accomplish my goals in an hour or two. If I hit step #3 and just am not working efficiently anymore, I stop coding.
At that point, I typically catch up on emails, write documentation, talk to people, and if my day works out well, the meetings happen while I’m in this down time.
Then I take a break, go for a walk, or play a game, and start the cycle again.
I get as much (if not more) done if I do two of those cycles in a day as I ever did working an 8 hour shift at a desk, because when you sit and work for 8 straight hours, you end up extending step #3 for hours, while also compounding your ramp-up time because there is no natural gap in your day to fit in meetings or do other things.
This is why I am a proponent of work from home, as well as a proponent of flexible schedules. Because it works better for the code, makes you more efficient, gives you better balance in your life and still leaves time in your day to interact with your team and do all your non-coding work.