[This essay has been expanded into a book, you should read it, here]

A chimpanzee brain at the Science Museum London

Image via Wikipedia

A popular saying goes that Programmers are machines that turn caffeine into code.

And sure enough, ask a random programmer when they do their best work and there’s a high chance they will admit to a lot of late nights. Some earlier, some later. A popular trend is to get up at 4am and get some work done before the day’s craziness begins. Others like going to bed at 4am.

At the gist of all this is avoiding distractions. But you could just lock the door, what’s so special about the night?

I think it boils down to three things: the maker’s schedule, the sleepy brain and bright computer screens.

The maker’s schedule

Paul Graham wrote about the maker’s schedule in 2009 – basically that there are two types of schedules in this world (primarily?). The traditional manager’s schedule where your day is cut up into hours and a ten minute distraction costs you, at most, an hour’s worth of time.

Prim clockwork of a wristwatch, watchmaking ex...

Image via Wikipedia

On the other hand you have something PG calls the maker’s schedule – a schedule for those of us who produce stuff. Working on large abstract systems involves fitting the whole thing into your mind – somebody once likened this to constructing a house out of expensive crystal glassand as soon as someone distracts you, it all comes barreling down and shatters into a thousand pieces.

This is why programmers are so annoyed when you distract them.

Because of this huge mental investment, we simply can’t start working until we can expect a couple of hours without being distracted. It’s just not worth constructing the whole model in your head and then having it torn down half an hour later.

In fact, talking to a lot of founders you’ll find out they feel like they simply can’t get any work done during the day. The constant barrage of interruptions, important stuff ™ to tend to and emails to answer simply don’t allow it. So they get most of their “work work” done during the night when everyone else is sleeping.

The sleepy brain

But even programmers should be sleeping at night. We are not some race of super humans. Even programmers feel more alert during the day.

Ballmer's peak

Ballmer’s peak, by XKCD and shame on you if you don’t recognise the style

Why then do we perform our most mentally complex work work when the brain wants to sleep and we do simpler tasks when our brain is at its sharpest and brightest?

Because being tired makes us better coders.

Similar to the ballmer peak, being tired can make us focus better simply because when your brain is tired it has to focus! There isn’t enough left-over brainpower to afford losing concentration.

I seem to get the least work done right after drinking too much tea or having a poorly timed energy drink. Makes me hyperactive and one second I’m checking twitter, the next I’m looking at hacker news and I just seem to be buzzing all over the place..

You’d think I’d work better – so much energy, so much infinite overclocked brainpower. But instead I keep tripping over myself because I can’t focus for more than two seconds at a time.

Conversely, when I’m slightly tired, I just plomp my arse down and code. With a slightly tired brain I can code for hours and hours without even thinking about checking twitter or facebook. It’s like the internet stops existing.

I feel like this holds true for most programmers out there. We have too much brainpower for ~80% of the tasks we work on – face it, writing that one juicy algorithm, requires ten times as much code to produce an environment in which it can run. Even if you’re doing the most advanced machine learning (or something) imaginable, a lot of the work is simply cleaning up the data and presenting results in a lovely manner.

And when your brain isn’t working at full capacity it looks for something to do. Being tired makes you dumb enough that the task at hand is enough.

Bright computer screens

This one is pretty simple. Keep staring at a bright source of light in the evening and your sleep cyclegets delayed. You forget to be tired until 3am. Then you wake up at 11am and when the evening rolls around you simply aren’t tired because hey, you’ve only been up since 11am!

A city

Image via Wikipedia

Given enough iterations this can essentially drag you into a different timezone. What’s more interesting is that it doesn’t seem to keep rolling, once you get into that equilibrium of going to bed between 3am and 4am you tend to stay there.

Or maybe that’s just the alarm clocks doing their thing because society tells us we’re dirty dirty slobs if we have breakfast at 2pm.

Fin

To conclude, programmers work at night because it doesn’t impose a time limit on when you have to stop working, which gives you a more relaxed approach, your brain doesn’t keep looking for distractions and a bright screen keeps you awake.

You should sign up by email to receive tips and science about productivity and keeping your sanity as a developer, here.

Enhanced by Zemanta
  • Pingback: Konsentrasi di Malam Hari « Zaki Akhmad

  • Jérémy Cochoy

    I write code for fun, and actually, I’m more efficient the night, between 11pm and 3am. You’re right when you say that during the day, we can’t stop looking mails, news, etc. Even if I’m in a quiet place, alone, I’ts really hard to make me do the job until the night, although it’s so easy to be caught by the pleasure of code writing after 11pm!
    But I’m thinking that, maybe, being a little bit tired could be the source of imagination and creativity.

  • Richard

    Because I like the smart uniforms and enjoy plotting world domination. :o )

    And you’re the IP-stealing genocidal maniac because…??

    (Seriously, why does everyone associate the Nazis with good manners and obeying the law? Surely that’s not the only thing they’ll be remembered for…)

  • http://kdcinfo.myopenid.com/ Keith D Commiskey

    Wow. When did working at night become a bad or poor sleeping habit? Is a good sleeping habit only sleeping according to normal society? I would think bad or poor sleeping habits have more to do with how much sleep you get vs. need, medically speaking, than when you do it.

  • Pingback: Why programmers work at night… – Odyssey Of Mayhem

  • Alan

    Sounds a lot like ADD.

  • Pingback: Working at Night | Andrew Cross

  • Pingback: 为什么程序员都是夜猫子 | 老邱

  • Pingback: Les geeks sont des nocturnes - FomoBlog | FomoBlog

  • Pingback: A geek with a hat » Blogging, hats, stuff

  • Sawyerrken

    You are not cheating sleep, you are shifting your timezone in your head. When others are sleeping you are working, when others are working, you are sleeping (or not, that’s your choice).

  • http://www.facebook.com/profile.php?id=1645485530 Sascha Lührs

    Want to increase your IQ by 10-30 points? Use brainworkshop.net for 20 minutes/day and join its corresponding google group.

  • MoonLightning

    I just had fun reading the article

  • Jkirk3279

    When everybody else is sleeping my mind expands, as if having other conscious minds buzzing around takes up vital cycles I need for concentration.    

    I have thought that perhaps the Sun’s radiation and radio noise might have something to do with it.

  • Eila

    I totally relate to what you said here. There is “I-didn’t-do-shit” thinking too, but it’s not exclusive. Many thanks for making me feel better because society in fact does make me feel like a “dirty dirty slob.” Pfff… the world is ruled by greedy early-riser despots whose money doen’t make them sleep till 11am :)

  • http://bbso.wordpress.com/ Soumya Vinod

    At night we only spoil sleep to get important things done, this mean more concentration on work

  • Pingback: Why do programmers work at night? « SKC's Journey with Microsoft

  • Pingback: Enseignement et recherche | Olivier Lafleur

  • Francisc

    I enjoyed this, thanks.

  • RoboMonkey 4000

    I can’t code, I’m just the secretary to the robot in my head. 4AM helps me take a dictation directly rather than trying to arrange a million post-it notes … near narcotic levels of caffeine helps keep the robot running 24/7 for when someone wants me to sit at a desk during the day.

  • Pingback: Dlaczego programiści pracują w nocy? | devTalks

  • januzi

    You have my axe.

  • Bineshperingat

    Good Post. I can relate to certain points. Really enjoyed your breakdown. :)

  • Stefan Beckmann

    Fuckin true…..

  • http://ishouvik.com Shouvik Mukherjee

    I 100% agree to you! During my 7 day winter break I used to hit bed a 3 in the morning and that was the time when I came up with the overall concept design and coding the framework.It’s 10:18 am in India now. And I can’t concentrate 100% on my codes because there are simply too many distractions.

  • TheDude

    This is all very, very true. Nice post.

    <- programmer who's been working at nights his entire life

  • Guest

     They make headphones that cancel out the CEO who arrives at 10 am and leaves at 4pm?  A “seagull colonel”, if you know the term.   They make headphones that cancel out the boss’ daughter appearing in my doorway and demanding that I pay attention to her precious problem RIGHT NOW?

  • autonomous

    not complete accurate, but everybody feels the need to explain their habits!

  • Tony Slacik

    That’s so true. Thanks for posting, now I know, I am not the only one weird “dirty slob” :)
    And those energy drinks idea is indeed interesting. Will see if it works. Anyway thanks again, really interesting.

  • http://twitter.com/scrawlings Julian Kelsey

    Certainly not true for me, I’m most productive if I get up with the sunrise after a good night sleep. I find feeling alert and fresh means I feel much better about the work and subjectively I think I do better quality work. I agree that office distractions can spoil productivity, but for this programmer it’s better to start two hours earlier than work two hours later.

  • http://swizec.com Swizec

    One could argue you’re still essentially working at night. Just at the different end of it.

  • http://www.facebook.com/akram.abdulrahman اكرم محمد عبد الرحمن

    i’ll keep doing it … lolz
    I AM A PROGRAMMER I HAVE NO LIFE AT DAY LIGHT BOHAHAHA