When is the best time of day to write code?
Musicians and vampires usually do their best work after the sun goes down. But does that also apply to programmers?
Musicians, so the stereotype goes, don’t like to get up early. When the Rolling Stones were recording Exile on Main Street at Keith Richards’ house in France, famously, they wouldn’t even begin trying to play until the evening (when Keith got up), then they’d record through the night. When the Beatles were filming the rehearsals for Let it Be, they had to be in the studio early each morning, which didn’t please John Lennon at all. “We’d be there at eight in the morning. You couldn’t make music at eight in the morning,” he later told Rolling Stone.
Image credit: REUTERS/Paul Hackett
Naturally, when you think of rock and roll musicians, you think of... programmers. Or at least I did recently, for some reason, and it got me to thinking about what time of day is better for writing code. Maybe you can’t make music at eight in the morning, but can you write (good) code at that time of day? Or does the best code only get written late at night when there are fewer distractions?
The answer, of course, is that it depends. If you’re an early bird, you’re probably more likely to prefer getting into the office before other people and digging into the code while all is relatively quiet. You night owls, on the other hand, may operate more like those rock and rollers (in more ways than one) and do your best coding later in the day or at night, maybe at home when the kids are asleep.
Other factors will play into your optimal coding times too, of course. Do you have a lot of meetings in the mornings or afternoons? Do you have an office, where you can close the door and focus, or an open space or cube where it’s easier to get distracted during normal hours? Do you pair program, in which case your options for coding times will be more limited? These things can limit your choice of when you can put on some music, tune out all the distractions and get your best work done.
Me, I’m a morning guy. Back when I was programming for a living, I liked to knuckle down and code earlier in the day, before too many other unforeseen headaches, meetings or demands would pop up. Also, I generally didn’t want to be coding in the evenings or night, so I could watch my shows and hit the sack early. Aside from the morning, though, I did always find a few other good times of day to code, such as:
During any meeting which I wasn’t running For some reason, I got some of my best work done (coding and otherwise) at a conference room table while others were droning on endlessly.
When my kids were being crazy While I usually didn’t like coding while at home (once remote access became an option), it always looked a lot more appealing when a child was melting down (or a poopy diaper needed changing). “Sweetie, I’m under deadline here; I’ll need to squirrel away in the office and get this done. Sorry!”
During a big sporting event that my team was involved in I love football and hockey, and I love it even more when one of my teams is playing in a big game. But the stress can sometimes make it hard to watch, so I would find working on some code, while keeping an eye on the game, a good way to keep my blood pressure at safe levels. It also helped me keep the game-related cursing around the kids to a minimum.
But that’s just me. What about you? What time of day do you get your best coding done? Early in the morning, late at night, or some other time of day? Let us know in the comments.
Read more of Phil Johnson's #Tech blog and follow the latest IT news at ITworld. Follow Phil on Twitter at @itwphiljohnson. For the latest IT news, analysis and how-tos, follow ITworld on Twitter and Facebook.