Looking back, I tend to do my most interesting programming at night. Writing the query optimizer for HiSQL kept me up a couple of nights. The first versions of libtre (a regex matching library with support for approximate matching) took a number of long evenings. I wrote the first prototype for transparent tunneling of TCP connections over SSH for SSH Tectia ConnectSecure in the middle of the night.
There’s clearly a pattern here. Good code happens at night. Night time is the right time… for coding. Sometimes, for me, at least.
The question is, why? Am I so excited about the ideas, so beside myself with the anticipation of turning the idea into something real, that I cannot sleep? Or is it that I simply need the peace and quiet in order to get into the zone? Maybe when I’m in the zone I don’t want to stop, then loose track of time, and end up coding into the night? All of the above?
This makes me wonder if software companies should rethink some of their policies regarding working times. Wouldn’t it make sense to allow doing the work in flexible pieces? Maybe spend the morning until lunch at the office, and do the rest at home in the evening?
Furthermore, there’s evidence that a short nap can significantly boost productivity. A 20-minute nap can make all the difference, apparently. I certainly cannot get much thinking done in the early afternoon. I tend to take care of some of my more rote, menial tasks during the groggy post-lunch time. I’m a manager, so there’s plenty of that kind of work for me, alas. But for a software developer, wouldn’t it make sense to take that 20-minute nap, and wake up fresh, instead of hours of half-witted monitor-staring?