blah_blah_blog 2.0

Adam Adair's lousy blog and other assorted blather

Insomnia makes my brain hurt

I’ve been working professionally as a computer programmer for almost 24 years, but I’ve been programming much longer than that. In that time I have worked on more software projects than I can remember. I don’t have a good number but it’s a lot, and when you do something over and over again you start to notice patterns. Design patterns are well known, ridiculously over documented, and I will never discuss them outside of a job interview because that’s the only proper place to discuss FizzBuzz, design patterns, the principles of Object Oriented Programming. I’m talking about behavior patterns. The things that seem to happen over and over so often that it’s no longer a surprise when it happens again. The most annoying and disruptive part of software development projects for me is the insomnia that comes with them.

I recently completed a quick 2 month development project, and it was enjoyable work that had some challenges that were new to me. Well, the first month was enjoyable. The second month was a struggle because I wasn’t sleeping very well. Some nights I was only getting an hour or two of sleep. I had insomnia.

The Mayo Clinic has this to say about insomnia:

At some point, many adults experience short-term (acute) insomnia, which lasts for days or weeks. It’s usually the result of stress or a traumatic event.

There is also a whole list of symptoms, but the ones that affect me the most are:

  • Daytime tiredness or sleepiness
  • Irritability, depression or anxiety
  • Difficulty paying attention, focusing on tasks or remembering
  • Increased errors or accidents

The problem usually starts when I’m in bed with the lights off, the whole house is quiet, and then I can’t seem to stop thinking about the project work that needs to be done. In my thoughts I think about the code that I have written, and I conceptually refactor it. I organize the code that I am going to write, and I design new features. I try and solve problems and troubleshoot known bugs. The problem is I can’t seem to stop my brain from doing this. Sometimes I try and distract my brain with some reading or listening to music, but I usually wake up way too early and then there is no going back to sleep. My brain is already working. Then eventually the sun comes up and it is time to go into the office and do the work that I was thinking about all night.

You might think that this sounds great, and for a while it actually does work well. I hammer out my best work early in the project, and in large volume. But eventually the lack of sleep starts to take its toll and my productivity declines. After a week or so of not sleeping right I find it hard to focus on programming tasks and I dose off in my office chair through out the day. I get irritable and lethargic. I don’t exercise as often. I fight with my wife over stupid things. This last time I forgot to pay a monthly bill I have never forgotten in all my adult life. I forget peoples names. I forget the names of people I’ve known for a long time. When I’m dealing with insomnia, I always seem to have a dull head-ache.

Once I’ve reached this point, then my nights start to change. I don’t think about code anymore but instead I start to have panic attacks. I get the overwhelming feeling that I am forgetting important things that are just beyond my ability to remember, that I missing critical deadlines, and that I am about to be a miserable failure in my job. This is the worst part of the pattern, because in hind sight I realize it’s just my mind playing tricks on me, but at that time it is my reality, and it sucks. In all the years that I’ve been doing this, I’ve not missed a deadline, not once that I can remember, but as hard as I try to extinguish these irrational thoughts, they continue to torment me through the night. I really hate the feeling of having to get out of bed after laying there for hours, unsuccessfully trying to sleep. It feels like failure.

Fortunately for me, my insomnia does not last forever. For reasons I cannot identify, things eventually begin to even out for me after some time, and I start sleeping better. Once I’m sleeping right then gradually my home and work life returns to normal. The Suck never seems to last more than few weeks, maybe a month at most. It also only happens once or twice a year, but it does happen every year.

It is a pattern, but one thing I can’t figure out for this pattern is which projects are going to trigger the insomnia. It doesn’t happen for every project, and like I said before, really I enjoyed this last project. The requirements were well defined and reasonable, and the schedule was easily attainable. There was no unnecessary pressure from managers or anything like that. It should have been a walk-in-the-park, and yet it wasn’t for me.

I’ve never heard another programmer talk about insomnia before. Last night I was curious if I was unusual in the experiencing this problem, so I googled “Programmer Insomnia” and it turns out I am not alone. Computer World had an article, linking to a study that claimed that 56% of the programmer participants had mild or severe insomnia, compared to 23% in the general population. So it seems to be actually quite common. It makes me wonder why nobody talks about it.