Coding nightmares

Upon reading the title, I think I'm right in assuming you probably thought I was going to write about a set of bad practices, or a series of horrible things one could find when refactoring code written by someone else. None of that, this time I'm referring to real, literally speaking, nightmares.

I think it happened for the first time almost 10 years ago. I had to implement a little shell in C for a university assignment and brave me hadn't a better idea than printing parts of the code from bash and examining it to get an idea of how the real stuff worked. It was all fine and dandy when reading the code at a train (apart from the odd looks that I got from people sitting near me, of course), but it proved to be a very bad idea to keep reading right before going to sleep. That night was the prelude of a long series of bad nights. I spent the whole night dreaming about pointers, structures, functions, loops, assignments, switch statements, case's, mallocs... you get the point. When I woke up, my brain was totally wasted. It was just like if I hadn't slept at all.

I thought that had only been a single event and wouldn't happen again, but boy, wasn't I wrong! It didn't happen again, though, until I began to work in web development, and the main cause this time was the Horror. Of course, I'm referring to Internet Explorer Exploder. I have lost count of the number of nights I spent suffering horrible nightmares where things work properly in Firefox and Opera and blah but aren't properly aligned in IE, or do not show where they should... Anyone who has had to develop for IE will for sure know what I mean.

The easiest way of avoiding these nightmares (for me) is to consciously focus on something completely unrelated before going to sleep. For example, to read something non-technical, like a fiction book where the action preferably happens in a time and place where the most advanced piece of technology is a ball pen.

But over time, there are days where I can't but get super excited about something code wise, and continue coding right until my eyelids feel so heavy I can hardly keep my eyes open. Those are the nights I go to sleep scared in advance, because I know my brain is totally obsessed with the piece of code I'm working with, and as Bette Davis would say, ... it's going to be a bumpy night! :D

And you? Do you have real coding nightmares? And if you have, how do you avoid them?