And not in a midlife crisis kind of way, in which you leave your family to take on Silicon Valley. That's for another post. But in a "what time is it and where am I?" kind of way. We don't normally think about when to code or even where to code most of the time. If it's for work, we code about an hour after we hit the office. And the cobwebs vanquish. Normally this happens around 8am-9am, depending on the office environment. If it's "Office Space" kind of work, then it's sometime after lunch usually. If it's personal, then many a time we choose the late hours of the night to do our thing in some remote location of our homes.
Here's a thought. Would you code more efficiently if you were in a certain location at a certain time, then where you are right now? And by efficiently, I really mean just a few small points. Such as, would you enjoy it more and would the code reflect that. If you've ever coded during a stressful mind state, you'll be familiar with the concept of deleting the entire function you just wrote as you must have been drunk while writing it. And when you're in the zone, you'll notice that the toughest programming challenge is almost trivial to code.
But when exactly is the right time to code? And is there such a thing? As a freelance/consultant programming dude, I tend to code whenever the time to code arises. But there's a feeling that goes with the time of day and a location and as a result it has an effect on the product. So let's talk about that today and see if maybe you should be working in the early morning in the library, or maybe you're better off in the late hours at a 24 hour coffee shop.
Early In The Morn'
Or work, as many programmers call it. Some people function well in the morning hours. They have their cup of joe, fire up their PC's and get to typing until sometime around lunch time, in which they take their break for the day. The morning can for sure be a great time to get some quality code out. It's normally quieter in the early hours so there are less distractions and you're not tired just yet. There's a pep to your step, if you will. Other's however, function better with people around and some noise. There's an energy that comes with having a group of programmer's together.
The early bird
I once knew of a programmer that went into work at 6am everyday, hours before anyone else made an appearance. Everyone thought him mad. As most programmers rarely see the early morning rays. But after talking to this guy, it turns out that the reason that he went in to work so early, was because he was alone in the office with almost no noise. By the time that others began to make an appearance, he was already done with most of his work for the day. And because of that, he got to enjoy his lunch more. And he got to go home early. So it wasn't really the time of day that did it for him, but the environment. In his case, both were tied together.
Personally speaking, working in the early morning hours doesn't feel quite right just yet. It's too early to tackle problems. And it sets a tone for the rest of the day. Not to say that it isn't a good time to do anything. Creating a plan of action for the day is ideal during this time. Jotting down the top 5 things that you want to get done that day is a good way to set the pace.
Late in the night
One can safely assume that many many programmers make the late hours of the day into their fortress of solitude. It's a quieter time (sometimes) and sleep is the enemy. This also has much to do with the fact that we tend to work during the morning, commute in the evening, recover at night, and then code in the late late night. We need to get our coding done by any means. And normally, this does indeed yield some results. It comes at a cost to our sleeping habits, and possibly our health as well however.
Running on fumes
It's hard to stay in the zone for very long during this time. Usually when in this "zone", one tends to program for hours on end. Ideas are flowing. Just imagine, you're building an RPG and you've gotten to the part where the ancient dragon is about to awaken from it's slumber and you coded a really cool way to beat the dragon, that only a handful of people will figure out.
note to self: work on game about ancient dragons...
You either won't be sleeping that night, or you'll be dreaming about dragons and loops. So you can GET into the zone during the late hours, but it will be more difficult to STAY there for an extended period of time.
Much innovation can happen during this time of course. When running on fumes, you're in some type of fight or flight response. You know you need to get to bed, but something is preventing it from going down. Some of my most interesting projects have occurred during the wee hours of the night. While fun for some time, they again take a toll. Every now and then though, you just need to.
Somewhere in the middle
The middle would be sometime after work for many. Some people tend to get out of work around 3pm, because they arrive early. So the evening hours would be an available time to code. This one is difficult to maintain I'll say. There's just too much motion and life going on around you to concentrate. I attribute coding to almost like reading a good book with a cup of tea. It's suppose to be this relaxing time when new ideas are brought to the forefront of yourself. They're your ideas and you're making them happen. As soon as you intermingle other elements of the day though, it starts to effect the results.
Or all of the above
Which leaves me with the final question. Do we have to work sequentially? Which is how we're used to thinking. We work from "9 to 5" normally. But is that the best approach? Coding isn't something that gets more exciting the longer you do it. Normally, the spark of an idea and how you're going to accomplish something is the high peak. And after that comes the code, which brings the excitement levels lower and lower the more you do it. So maybe, we can ride the peaks. We can get excited for a solution, start to build it, start to fall, do something fun, come back and repeat.
Regardless of the time of day however, there is a time in the day when everything comes together nicely for you to ponder, design and create. And it's different for everyone. Maybe you code everyday around 1pm in your home office, but at that time the gardener also does his thing. Maybe you never noticed it, and it just becomes a part of the background noise. You grumble to yourself about why he has to cut the lawn during that time instead of doing something about it. So play around with your time and your environment until you find that sweet spot.