Twitter GitHub Facebook Instagram

Daniel Irvine on building software

Being tired

8 July 2014

The state of tiredness is not conducive to good programming. That might seem obvious to you, but it’s surprising how often we try to work when we’re not fully rested. Think about the last time you arrived at the office after a bad night’s sleep. How much did you actually achieve that day? Probably not a lot.

Consider this: sleep deprivation causes a huge number of motor vehicle accidents every year, many of them fatal. Most drivers will know to not drive if they are sleep deprived. And that’s just driving--a task which primarily exercises the memory and decision-making functions of your brain. Coding, on the other hand, exercises not just those functions but also the creative functions.

Caffeine won’t help. It might keep you awake but it won’t repair your brain function, unlike sleep, which will.

Unfortunately, we all suffer lack of sleep sometimes so it’s inevitable that on some work days we’ll be tired. On days like these, the best thing to do is non-programming related tasks. Reading, draft writing, meetings--anything but writing or reviewing code.

If you’re unsure of how your own performance suffers when tired, keep a diary the next time you arrive at work tired. Briefly jot down what you did and how well you felt you did. Then when you’re next fully rested and working at 100%, review your diary and perform a code review of any code you wrote that day. Has the code already been modified subsequently to that time? How correct has has it been--did it contain any errors?

If you’re anything like me, you’ll soon avoid writing any code when sleep deprived.

About the author

Daniel Irvine is a software craftsman at 8th Light, based in London. These days he prefers to code in Clojure and Ruby, despite having been a C++ and C# developer for the majority of his career.

For a longer bio please see To contact Daniel, send a tweet to @d_ir or use the comments section below.

Twitter GitHub Facebook Instagram