I do find, however, that solutions to sticky problems pop into my head in the shower, during a long steady run, or after a walk in the park, which I guess is a similar phenomenon.
Woke up from those somewhat with a headache, not well rested.
Feels highly dystopian that I’ve reduced my brain to an advanced calculator.
I don't feel tired when I wake up, but I don't feel like I 'reset' either. I've had a couple of times where I'll wake right up and bang something out like I was being dictated to. It's almost like all the pieces were already there in your mind and they fall together when you aren't trying to force them. Brains are weird.
I personally don't think it's worth giving up an email address and spending the time to do so to read a blog post.
The article isn't too much longer past the paywall and basically just says "don't try to, just familiarize yourself with the relevant code to a specific problem and you might wake up with the answer"
"How to program in your sleep" is a click baity and inaccurate title for the content.
A better one might be "on programming in your sleep"
One aspect of this that hasn't been mentioned though is just fatigue. By analogy, if you were training in a gym for an hour and then decided to try to go for a heavy bench press, it might be harder and harder the more you try, since you are getting more tired.
But if you take a long lunch break or come back fresh the next day, it may be relatively easy.
So I think mental fatigue also plays into this. Although the other theories seem fairly established and more interesting.
But maybe you can extend the analogy further if you consider maxing out and then resting for a few days so that your muscles have made a slight adaptation (become slightly stronger). In this case, when you returned to the bench press, not only would your muscles be rested but also more capable.
This could be similar to the memory consolidation and organization that goes on during sleep which could provide an information schema that already incorporated key aspects of your problem and maybe previous similar problems/solutions, giving you a head start on solving it.
As an aside, it's interesting to think about how much work your memory is doing for problem solving with things like analogical reasoning. Which is one reason that it may be hard to measure intelligence accurately and fairly, since all skill and knowledge involves developing and accessing compressed problem/solution spaces.
Solutions emerge in my head as I sleep, usually after a day of brute-forcing a problem so much that it spills over into my mind's eye during breaks, which spill over into my dreams, where glowing forms congeal into solutions.
I recently read some comments here about people having vivid dreams of playing Tetris. That's exactly how my dreams feel, but in mine, I see either code, foreign languages, or a spreadsheet. Extending your gym analogy, it's like hitting your PR the day after going all-out on volume training.
Which in a way, the author is indirectly describing. Engaging in activities that are "automatic" (e.g. showering, long walks) also allows the conscious to drift and frees the subconscious to interrupt the conscious with some solutions. Hence the best ideas under the shower.
Taking a break from the problem can sometimes be the faster way to a solution, illogical for modern bosses who believe only working on the problem will solve it.
[0]=if you don't believe this then try to consciously pick up a cup of coffee and drink from it. The coordination of muscles, swallowing, and everything besides is the subconscious. The conscious, if at all, had the thought "I want to drink coffee" or it might just have been a feeling between messaging and eating a breakfast toast!
if the brain is actually a biological neural network then this is not surprising. input takes time to propagate through the layers of the network and sleep is a necessary part of how that biological process works so the information needed to solve a problem might take a nights sleep to propagate to the depth where it can be solved or it might need a variety of other inputs that take time to acquire before enough information is ingested to reach a solution.
Yep this is the most important part. If you go on a walk or shower but think about how to solve the problem you're not going to get this benefit.
Sleeping is ideal because you have no opportunity to consciously think about it but it can be done while awake if you find yourself truly disengaged from thinking about your problem.
It also works during a toilette sitting :D That’s why for me an ideal bathroom should be well lit, preferred with sun light, well aired with lush green plants, clean and with material for reading.
Yes. The solution sometimes come as well, but the fresh new idea almost 100% of times after a power nap or something.
Half-waking in the middle of the night and realizing that programming problems from the office were thrashing around in my mnind like carps out of water.
Really, really irritating and ultimately fatiguing.
A separate but related issue I’ve found is that I’m often dreaming in programming languages now, which is a totally surreal experience. I think this is like how some people say when you move to a new country and learn a new language, there comes a point where the language in your dreams shifts from your native one to your newly immersed language. But I find it happening to me now: a complete standard dream scenario, but all thoughts are expressed completely (and partially nonsensically) in SQL, or python, or classes and subclasses, interfaces, data models, APIs, tests, and error handling. It’s really odd. Especially because it’s not even specifically a work challenge, it’s just like a standard dream but my brains way of constructing it happens to turn it into a technical challenge somehow. These nights are rarely restful.
This probably indicates some underlying anxiety or something that I should more seriously and proactively address, but for now I’m just happy if I can get a restful 6-7 hours in.
I’ve found for me it’s most effective when I very specifically lay out the rules of the problem in text, go to sleep and re-read through the rules. Usually I’ll have some new idea and change the rules I made to fit this probably-better idea.
Sometimes it’s pretty interesting to see how the “specs” of the problem change before and after solution.
Incubation: solve problems for money makers in your sleep.
https://www.youtube.com/watch?v=f84n5oFoZBc
Also Polya's How to Solve It, referenced in that talk:
I woke up in the morning with a solution in mind and went straight to the keyboard, but the strangest thing is I didn't really consciously know what I was writing, I just started typing as if straight from my subconscious. I was familiar with the code of course but I didn't think about the details of what I was writing. And it actually worked perfectly, basically first time.
It was a very spooky experience.
Don't use your phone, experiencing the walk is the point. Watch and walk and think.
The idle mind can be very fruitful, it's a shame that we've let attention machines steal this. Not that I'm any better.
- You are going to bed only when you're tired, don't try to go to bed and hope you will become tired by just laying.
- Have at least one long walk a day (it helps my sister when she is doing it when it's still daylight, but ofcourse it depends on where you live)
- Don't drink coffee after 14:00
- Stay off social media after dinner time
- If you are reading a book using a screenreader or laptop make sure you filter the bluelight