A Corollary to Sleeping On It
Just "sleep on it" is one of the most valuable lessons I've ever learned in my professional career. I find that when I start getting tired, my brain starts disk-thrashing for solutions. What I mean is, the time spent in logical analysis plunges and the time spent in trial-and-error, shotgun-style problem solving spikes. In the worst of these sessions - often well after the sun has come back up as I work - I end up with something that looks like a solution, only to reveal its whole host of new bug-inducing behaviors after I run with it and cut a software release or deploy to a production environment.
The solution, of course, is to understand this about myself, and know when to put it away for the night, even if the problem isn't solved, and I don't know what the solution is. In fact, it seems that more often than not when I can do this, I wake up to find the problem has a simple solution that I just couldn't see the night before. I don't know what happens while I sleep, and I know it sounds a little silly, but this technique actually works about 80% of the time. In the other 20% of situations, it still manages to keep me calm, productive (as much as is possible in such situations), and focused on the problem at hand.
Last night, I found a corollary to this sleep-on-it rule: Never revert your changes BEFORE bed. Last night I was working on some multithreaded code, went pretty deep down a rabbit hole in pursuit of a solution, and finally gave up feeling like I was really on the wrong track. I thought I was so far off-track, in fact, that I reverted the code. This morning, I woke up to realize that I had a decent idea, but had missed a few very small, but key, points that probably would have made it all work.
I always think I'm going to get confused and accidentally commit really horrible code. It's part of that self-censorship that goes with a constant awareness that others see my coding skill exemplified every time I commit, I guess. What I need to remember is that I'm smart enough to remember what I was up to last night, and I'm highly unlikely to get that confused. Last night I lost a couple of hours worth of work, and I've (hopefully) learned my lesson.
