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?

manolopm
Of course, I have a lot ot that “nightmares” but I love them :D
I have it only when I’m too involved in a project, and as you say that happended a lot of time when I was in the university.
I love them because I go bed with something that I didn’t solved and when I wake up I’m dead but with a solution. A lot of times I wake up go to the pc and write the code on my mind and works without debug it :D
But … as you say there are times that you want to avoid it so… I didn’t go to bed until I finnish with the thing that brings me crazy :D I’ll try your trick the next time :)
Regards from Canary Islands
sole
It definitely works if I read after coding and before sleeping. But sometimes I even need to consciously force myself to stop thinking about the problem.
I liked to believe that I would wake up and the problem would be solved in my mind but to be honest the last thing I would do if I woke up in the middle of the night is to go to the computer and begin typing.
Usually if I wake up after a particularly horrid nightmare (e.g. mallocs which produce segmentation faults no matter what I do) I go out of the bed, try to think of something nice to distract my mind and when I have forgotten about the nightmare, go back again. Oh how I dislike those nights!
luchyx
When you sleep your brain run the “garbage collector” and erase unuseful things and dreaming is the “progress indicator” of that process.
Yes I have coding nightmares too, sometimes I have ones in which a Unfinished Func.Spec is following me! or even worst when an Excel file appear below the bed and says “I’m your todo list!!”.
A cup of wine will help you a lot to get sleep! (and better in the company of a gentleman).
Sweet dreams!
Zarate
1000 bells ringing in my head : )
Usually is not bad for me. As manolopm says, I sometimes take my coding problems to bed and sleep with them. And exactly like you guys, at some point during the night I scream in my head (sometimes out loud-ish): “THAT’S IT”! But I never wake up at that moment, just keep it in my brain to fit it the next morning.
But also sometimes I keep thinking and thinking and at moments I’m half awake, half asleep for hours… Definitely I don’t like that.
Geek problems indeed!
sole
@luchyx – is not like I can’t sleep -I do, “like a log”- but I also get those coding nightmares! haha! I would replace the cup of wine with a mug of milk anyway :D
@Zarate – if I have an idea, and then go to sleep again, I will forget it for sure, unless it’s something that really really impacts me and gets fixed in my brain somehow.
It’s interesting to see I’m not the only one having this sort of dreams!