Yesterday I was working on fairly large coding problem. I was trying to understand what was going on in a piece of code someone else had written, and it was more than a thousand lines of code in just the main file, with 5 included files. I was starting to get the hang of it by the end of the day, but didn’t quite have it nailed down.
Last night while I was sleeping I figured out the key issue.
This isn’t that uncommon for me, and I’ve read articles by other people extolling the virtues of coding in your dreams as well. I think there’s a lot of value in sleeping on a problem and letting your brain mull over it while you sleep.
This scenario can’t be unique to coders, but I’ve never heard any non-coders talk about it. Do detectives figure out whodunnit while they sleep? Do Engineers figure out why the bridge fell while they sleep? Do accountants figure out how to balance the books?
What do you figure out in your sleep?
5 thoughts on “Sleeping on it”
You don’t know how many coding problems I’ve solved while actually asleep. More than once I’ve discovered errors in my code then shot awake in the middle of the night. Needless to say, I don’t get much real rest…
I’ve awakened in the middle of the night after wrestling with a Scripture text with a complete sermon outline. Then again, that often happens during the day when I’m not even thinking about it. I may be talking to my wife about the kids’ sports schedules, etc., when suddenly I have to stop mid-sentence to write down the thoughts that popped into my head unbidden. Kind of cool, really.
The first idea from sleep I remember was coming up with a theme and script for an Odyssey of the Mind competition in middle school.
The second time was in high school when I came up with a more efficient method for drying cars with hand towels (I was working at a car wash at the time).
Along with sleep, ideas come to me when walking the dogs through our local park. I just let my thoughts wander while my body moves along the familiar paths.
I’ve come up with a lot of gadget/app ideas on those walks. Too bad I’m so bad at finding the time to implement them.
In the world of design it’s called “The Phoenix Effect.” When you’re struggling with a design, set it aside for a day (or more). Once you sleep on it, the good ideas rise from the ashes of your previous struggle.