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