Sunday, April 13, 2008

Burning the midnight oil

So I just finished up my last piece of development for today, and it's now 1:18 in the morning (last night I was up to 2:30). After roughly a day and a half of solid coding, I have come up for air momentarily to consider an issue of interest to me: Why am I so freakin' productive at night?

Here in the wee hours of the morning, I seem to accomplish things at 3 times the pace I do during the day, and with fewer bugs to boot. You might think to yourself, "Who cares why? If it works so much better for you, just work at night instead of during the day!". Well if that's you, than you either aren't married or you are and you don't want to stay that way.

Seriously though, I can't be staying up into the middle of the night all the time, and I already have a good 8 hour block every day set aside for development, so I'd really be excited about being able to capture that productivity boost at will. With that in mind, here are a couple of my ideas as to just what makes the night such a great programming environment:

Zero Interruptions

This may be the biggest part of it, honestly. When the sun is down, nobody is calling you, texting you, IM-ing you, or sending you emails (and if they are, you can safely ignore them without offense because, hey, you were in bed, right?). For me, that's a big deal-maker that I've noticed even in my old day job's environment; days when I was left alone for a while were days when I was able to do serious damage to those endless defect lists.

The world slows down

I don't know about you, but in the middle of the night my RSS client doesn't grow at the same feverish rate that it does during the day, and that means that there's less of a chance of me seeing something cool but unrelated and taking 30 minutes to try out a tutorial that has no bearing on my current project (What?!? They're running Ruby on Javascript now?!?! I must play....).

Open schedule

Tell me if this sounds familiar:

"OK, I've got a few things I need
to get done here, but I also
need to be leaving in half an
hour to get to that meeting on time,
so I need to work on something I
can knock-out quick.
Hmm......I'm hungry."

When the moon is up, there are no meetings or conference calls, or really anything scheduled in the near future, so you don't have to keep surfacing to check the time. Theoretically, it takes very little effort to look at the clock, but for me (and maybe this is ONLY me) if I'm looking at the clock it means I've momentarily stopped thinking about what I was working on, and even though it's for only a very brief time I've still lost some momentum.

It feels pretty badass

Perhaps not everyone feels this way, but to me there seems to be a sort of "badge of honor" that comes with working on something late into the night. It's something that resonates with other hackers; we like telling stories about how late we were up hacking as much as we do about cracking some bug we were after for 3 days, or about crashing a production application with a bit of untested code, or about losing weeks of work in a hard-drive failure. We can all say "yeah, I've been there", and that makes it a common bond in this psuedo-sub-culture of hackerdom. So maybe I'm more productive at night for the same reason that I can work-out harder and for longer when I'm listening to high-energy music: the attributes of my environment unconciously cause me to more closely conform to a strong personal narrative.

Extracting the essence

So based on my possible reasons above, here are some ways you could recapture some of that midnight-power for the daylight hours.

1. Minimize interruptions during hacking time. Maybe even turn off your cell phone and close your email client, it'll all still be there when you resurface.

2. Keeping up to date with industry news is important, but probably not as important as actually contributing to the industry. That's right, close the news reader, it too will be around when you are ready to take a break.

3. Find the next thing on your schedule for the day (hopefully a few hours off) and set a timer or an alarm that will go off in time for you to prepare for whatever it is. Hopefully by knowing that the alarm will go off before you need to do anything you'll be able to leave the time management up to the device and focus all your brain-cycles on the task at hand.

4. Not sure about this one. I guess I could say that the more attributes of your environment that remind you of awesome hackerness, the more awesome of a hacker you will be (my english prof would probably cringe at that sentence). Maybe you should grow a beard and take off your shoes? ; )


xenoterracide said...

I'm naturally nocturnal. I prefer being up at night and most nights I do get more done. Just because there aren't people to distract me.

Adrian Corscadden said... just inspired me to keep on working.

That sums me up in a nutshell and I'm feeling pretty bad ass right now.

Tim said...

I'm writing this at 3:51am, having just finished some very productive work on my thesis and nodding my way through your article.

However I think it goes beyond the peace and quiet. I usually get tired early in the evening, at which time I chill out, watch a movie, whatever. I can then either go to bed, but if I start working, wham, I have 6 hours of non-stop productivity and I'm suddenly wide awake.

As you say though, doesn't work so well in a marriage. Also if my wife stays up, it does detract somewhat from my productivity...

James Carr said...

In Death March Edward Yourdon even makes the suggestion of moving the development team's shift (if they are willing) to night hours. He lists several reasons (zero interuptions being one).

I've always written some pretty productive stuff late at night and in the early morning hours. ;)

James Carr said...

Oh I wish I was as lucky as you... I am subscribed to several european blogs too, so my RSS feed grows overnight too.

Kirubakaran A said...

I think this is because your inner voice is doing this at late night:

"Dude what the hell are you doing at this ungodly hour?"
"I am trying to get _____ done"
"Oh okay"

So, you are continuously conscious and aware. Naturally you are more productive. I create the same phenomenon during the day too by using this simple tool I wrote: Smacklet

(shameless plug, but I mean it)

Anonymous said...

It's always good to hear a fellow night owl pipe up. I recently took a 9-to-5 job and it's half killing me. I could handle it if the day were 25 or 26 hours long, but this is Earth not Mars.

My personal theory is that managers tend to have kids and they have to get up at some gawd-awful hour, so they inflict it on their employees too, because "misery loves company".

Here is enemy propaganda:
"Learning to live like an early bird"


curson said...

I'm largely nocturnal, especially with my hobby. I do not code, nor have a work that I can take at home, but one of my hobby is writing, and I'm apparently able to produce the most just between 1am and 4am ;)

HM2K said...

Good topic for an article, and a well approached one too.

Something I'd like to have covered myself.

Well done!

pyninja said...

The artificial light of your computer tricks your mind into thinking you're not sleepy.

Paul said...

For me I think that the biggest thing is that there is no closing time for the development I am doing...

If there is something coming up within the next couple of hours, I feel as if I need to devote half of my mind to just remembering that thing (I often forget if I get too engulfed in what I am doing).

Perhaps I will have to try out the timer concept you mentioned... Then you know the buzzer will go off and you can move on.

Anonymous said...

Learn what a hacker is. You are not one.

Anonymous said...

The other big one: motivation is proportional to opportunity cost.

I class lots of hacking as distasteful yet important, with unpleasant critical decisions to make. In the morning, it's hard to imagine doing distasteful stuff all day long, and easy to rationalize goofing off or doing less demanding stuff.

So I'll goof off until a big (possibly unpleasant or boring) commitment comes up, like a long meeting.

Then about 5 minutes beforehand, I'll stress out because I haven't started the important stuff yet, but by the time the meeting's over the day will be half gone. If I start hacking then, I get ultra-productive, since I'm motivated to make quick decisions and not stew. So, often I can actually get a lot done by going late to the meeting.

Late night is similar: I really want to be in bed, but the important big thing can no longer be put off, and I no longer want to do trivial stuff.

Bob UK said...

Fellow night Owl here and I frequently get my best work done in the early hours.
Difficult to transfer that level of productivity to the office which is a pain.
I think it is the silence and peace that helps me most.
So many times in the office all the things supposed to make us more efficent (email,aim,phone,meetings etc) can just get in the way of getting work done imo.
I say this to the boss this but does he listen...

Dick Logan said...

For me, being that I procrastinate and wait to do everything at the last minute, I have no choice but to work really really hard in the wee hours of the morning.

Doing things at the last minute, I think that's what does it for me.

Kevin Harris said...

To anon. who suggests the author learn what a hacker is: please do enlighten us, so we can all be as awesome as you.

Anonymous said...

I guess you have a point Kevin. Lately the term hacker seems to have a distinctly different meaning and connotation than it did back in the 70s and 80s.

Back then hackers were people who understood the technology from the very bottom and up, and moreso. They did stikingly innovative, albeit sometimes illegal, things with technologies of which the original designers never intended nor ever even fathomed was possible. They were the first, and in my opinion, true hackers. Many of these people are the reason why technology is where it is today.

Granted, nowadays the term, after a slow evolution of misuse and bastardization, seems to apply to just about anybody with a computer or hell, an iPod. Maybe a toaster. For an example of what I mean visit

Now, if you want to label yourself a 'hacker' because you can write some Ruby to make a little web app, then I suppose that's your right. But please don't for one second even entertain the notion that you or your peers' paltry contributions to technology are on par with the achievements of the true oldschool hackers.

Kurt Christensen said...

Great post - it really resonated with me. I've thought about this a lot, and my hypothesis is that during the day I have a lot of energy, but I also feel pretty ADD - easily distracted. At night, my mind is still working, but it's slowed down enough that it becomes much easier for me to focus on a single task for an extended period.

Ken Iovino said...

For me it's the interruptions that prevent me from working through out the daytime hours. Almost every night is dedicated to coding. I just get into the zone for 6-7 hours straight and get a massive amount of work done without a single interruption. The only down side to that is the company I work for doesn't operate during the night and they want me available during "normal" business hours, which is fine but I don't feel I get enough done during those times.

jsnx said...

Maybe you should grow a beard and take off your shoes?

Works for me.

Anonymous said...

Definitely know what you mean; I'm most productive between 11pm & 3am. And yes, the beard does help as well...

Anonymous said...

your article is a great explanation for why you are more productive and I personally share the same dynamics, but its entirely anecdotal. There are countless studies that PROVE, with zero room for argument, that people are less efficient at night. For example, companies have to pay exponentially higher insurance rates to cover their night shift workers, because accident rates are so much higher. ... ...productive night people are a minority. In fact, we'd be more productive in the morning, if there was an equally small number of people interrupting us.... ...good article, but nights are not, on average, more productive.

Anonymous said...

Night owls have dramatically higher average IQs.

The only real question is do stupid people get up early or does getting up early make you stupid?

xenoterracide said...

yes and working a night job can cause health issues. Many of which I've heard are caused by not getting enough sunlight. Basically get a UV lamp.

TechieGeek said...
This comment has been removed by the author.
TechieGeek said...

I can almost completely relate to what you have written. Have always been an owl myself!

(I blog at techrunch)

SlvrEagle23 said...

For me, you said it best in your own words..."the attributes of my environment unconciously cause me to more closely conform to a strong personal narrative."

It's not really unconscious, though. I'm entirely aware that the right lighting, music, air temperature, mixture of caffeine and mountain dew in bloodstream, and comfortable pants are what put me in a narrow band of productivity unparalleled by any other time during the day. I try to set up the ideal situation as many times in a day as I can, by shutting off the fluorescent lights and grabbing a pair of headphones, but you're right, there's just no replacing the inexplicable sense of peace from having the world around you be pitch black except for the glow of the monitor's backlight.

Code is much like any other creative art in that someone with a genuine passion for it can, given the right conditions, produce incredible examples of it. Even when you're laying in bed, watching the sun rise outside and realizing you just laid waste to your sleep schedule, you can still be proud of what you created, and that makes it all worth it.

Anonymous said...

Regarding the interruptions during the day, here's a trick that i've been doing over the last few years.

I find that email is the number disruption. So i let my colleagues and bosses know that i will only check my email at scheduled intervals 2 or 3 times a day.

Some people asked me what i did in situations that needed my prompt attention. If it needs my attention straight away, call me or come to my desk.

More and more people i work with have adopted this and it seems to work well.

Naturally it depends on the type of work you do.

Max said...

I love coding with my shoes off at midday, it makes me feel eccentric.

SEO Ranter said...

Coding with one's shoes off is complete win! And yeah, a lot can happen overnight. It's been a while since I've been off the dayshi[f]t.. thanks for inspiring me to get back to the midnight oil!

Scott Cowan said...

I was working late at night like you but found that after I wanted to get to sleep I needed an hour to get out of hack mode so I just didn't get enuff sleep.

What I do now is get 3 hours early and work on things til my day job starts.

The other routine I like is segmented sleep. So I'd get 5-6 hours at night and another 1-2 during the day and power nap when I was tired

Anonymous said...

I'm with you on this one. If only someone could explain this to the rest of the world.

w43l said...

its gonna look just like everyone commenting here !
but ya ...
no really ..
i mean it
it just works
the night is hacker's best productive enviroment
i used to use this line "leave me alone , im a night creature"

JGailor said...

Interesting post. I see this a lot with developers that I've worked with in the past. I take a complete opposite tact. I wake up between 5 & 6 am everyday and get almost all of my work for a given day done before 11am. My girlfriend works east coast hours, so she is already off to her job (PST here), and the apartment is empty. Or, I head to the office and get it all to myself until people start slowly showing up around 10. Having that interruption free environment really produces my best work each day. It's when people start trickling in and want to meet, or start asking questions about project status, some linux command they should know already (read the man page), or what I'm doing over the weekend that I really start to lose my focus. I've found this schedule not only let's me write the code I need to, but also maintain a serious relationship and all of my friendships.

As a corollary, as we consider ourselves "smart" as programmers, I never understood the desire to work from late morning/early afternoon into the late night. Primarily, there's nothing to do at 6am in the morning for all intents and purposes, so why not do your lions share of your work when other pursuits are off-limits because of normal business hours (for both businesses & people), and do all the getting out and about things in the evening when the world is active.

peterb said...

One size does not fit all. Sleep research has found there are 3 distinct types of people: larks (early morning productive), owls (night productive) and indifferent. larks and owls each make up about 20% of the population and indifferent making up about 60%.

It has been demonstrated that allowing an owl to be on his natural circadian rhythm (letting him/her work late and sleep until noon) will increase their productivity by more than 30%.


Max said...

JGailor, I actually agree with you that exactly *when* the quiet hours happen is immaterial. I work in the games industry and we are pretty renowned for working long hours, and it is actually a side effect of the production schedule that late night hours are better than early morning ones.

Typically, QA will be smashing on a build in the early morning (from 4 to 6), so it is up to the engineers to come in after that (10ish) and work til everything is fixed (somtimes til 2-4am). Perhaps this schedule could be reversed so QA was late at night instead? :)

Now, however, I am off to work to be eccentric with my shoes off for the rest of the day.

Paul R. Potts said...

You hit it on the head. I've been naturally a night owl for as long as I can remember; high school and before, where I really loved to work on my hobby and writing projects while everyone is asleep. I'd start my homework after Letterman. Of course, I had to get up at 6:30 to get ready for school, so I was chronically sleep-deprived for years.

I'm very easily distracted. When it's dead-quiet in the office, the distractions gradually melt away and my concentration revs up.

I'm been fortunate to have a number of jobs that allow me to work this way, but there's always at least some friction due to my schedule, some co-worker suspicious that I'm not doing my job. But when I've had a corporate job requiring me to be at my desk at 8 a.m., I can do it, but my concentration does not adapt. I am simply never very productive in that work environment.

It's a bit harder with a family; we all tend to be on a slightly skewed schedule. But fortunately with a combination of homeschooling and afternoon activities for the kids, it more-or-less works out.

pauldwaite said...

Tim Smit (head of the Eden Project here in England) has his team take all important decisions about the business at night. He says the atmosphere is different, and they get better decisions that way.

I tend to get passionate flashes of inspiration when settling down to sleep. Stuff that’s been swirling around in the background all day suddenly crystalises. I decided to quit my full-time job and go freelance after one such flash.

Outside of flashes like that, I don‘t find myself more productive at night though.

Anonymous said...

Good points. These are also great positives for telecommuting

Loren said...

Love it. Especially the bad-ass factor. It's too true and well put...