There are times when our body is present but our brain is not. Writing code when we're not fully engaged can be challenging but it's possible. I might be checked out if I have an especially bad insomnia streak; it becomes much more difficult to concentrate.when I hit my 3rd or 4th day in a row without sleeping much. The following Bulleted List Of Unsolicited Advice™ contains the insomnia coping strategies that have worked for me.
- Turn off the obvious distractions. I'm looking at you, Twitter.
- Keep the blood sugar level. Being tired sucks, but being tired and hungry is lethal.
- Be honest with anybody who's depending on you. Let them know that you're not operating at peak performance and let them know why if you can.
- Pair. Pair on problems, pair on planning, and pair program. Don't swim alone, kids. See the above point and let your partner know what state you're in and that you'll be leaning on them.
- Zoom Out. The worse off my brain is, the worse I am at making good tactical decisions. When I'm tired, I assume that my code micromanagement abilities are wrong and that my partner is always right. On the flip side, I seem to be better at keeping big picture focus when I stop trying to drive the code directly. In short, if your partner needs to drive the code then you may need to be project manager for a day.
- Go home. If nothing is literally on fire and your brain just isn't functioning then just go home and get some rest if you can.
I've been lucky enough not to suffer from sleep issues in the past few weeks. Here's hoping that neither you nor I need this list anytime soon.