I can buy that information is consolidated for generalization during sleep. And also that the subconscious mind does a lot of work that we aren't aware of.<p>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.<p>But if you take a long lunch break or come back fresh the next day, it may be relatively easy.<p>So I think mental fatigue also plays into this. Although the other theories seem fairly established and more interesting.<p>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.<p>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.<p>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.
Along similar lines, there is Rich Hickey's talk "Hammock Driven Development":<p><a href="https://www.youtube.com/watch?v=f84n5oFoZBc">https://www.youtube.com/watch?v=f84n5oFoZBc</a><p>Also Polya's How to Solve It, referenced in that talk:<p><a href="https://en.wikipedia.org/wiki/How_to_Solve_It" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/How_to_Solve_It</a>
I had an fairly extreme version of this. I went to bed one night after feeling defeated because I thought I'd made a fundamental design error and my core data structure was broken and it couldn't do what it needed to do.<p>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.<p>It was a very spooky experience.
Oh, I do it all the times. So much, I know I don’t have to try too hard to solve a vexed problem. All what I need is to remember all the details and the difficulties arises from attempting solving it, so lucid that I can virtually juggle the things entirely in my head. Then I keep day dreaming about the problem and eventually go to sleep. Most likely when I wake up, I would have a solution, or at least a fresh new idea to try.<p>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.
I get those programming dreams but have always really disliked them, and find I wake up feeling like I didn’t actually sleep, even if I was in fact asleep all night with code flying around in my brain like tetris blocks. I’m not sure I’ve ever woken up with a great idea after one of those nights.<p>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.
I found myself assaulted by the evil twin of incubation.<p>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.<p>Really, really irritating and ultimately fatiguing.
Going for a walk often helps too. My campus had a nice place to walk and I'd often go for a spin and just relax and think a bit. If you're really stuck or totally off track go for a long one.<p>Don't use your phone, experiencing the walk is the point. Watch and walk and think.<p>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.
If one remembers that the subconscious makes up approx 80% of the brain[0], there is a lot of problem solving potential in switching off the conscious and "backgrounding" problem solving to the subconscious.<p>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.<p>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.<p>[0]=if you don't believe this then try to <i>consciously</i> 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!
What a clickbait. Calling this "how to program in your sleep"? I mean, seriously? Everyone with sufficient experience knows that putting aside a problem that you're trying to solve and giving it another go some time after can be of tremendous help. What it would be nice to know or at least have some explanation is why this works most of the times.
So many interesting articles I'm never going to read because of the paywall. I'm curious how people who see this actually create an account to gain access?<p>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.
I remembered it happen in a very strange way when I studied calculus. I had a hard time to remember the integration rules and how to apply them. Spent a lot of time on it. But at one point I had a dream where integrals came "flying in" like in a computer game, and I solved them one after another, just like I can solve 1+1 without hesitation. Whether I really solved them or this was just imagined is of course the core question. But the dream was so detailed and crisp, and I felt so conscious in it, that I think I may actually have done that. It was a feeling I very rarely have felt ever before.
I expected something more insightful. As someone who don't have sleeping problems, but have family members who does, from what I seen the most effective impact happened when:<p>- 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.<p>- 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)<p>- Don't drink coffee after 14:00<p>- Stay off social media after dinner time<p>- If you are reading a book using a screenreader or laptop make sure you filter the bluelight
I've been led to believe that the reason why a lot of written exams include the instruction "read all questions before starting on the problems" is due to this subconscious "cooking on the back-burner" effect. Problem solving in your sleep might be related to that strategy. I haven't read any empirical studies on the effectiveness of this testing strategy - but I suppose it should be fairly easy to set up such an experiment.
Many years ago I played drums in a band, and often the guitar players would write weird little off time parts that I couldn't do at first, but I could the next day. I used to tell them that I would practice in my sleep. The first time I said it I was ridiculed, but when I nailed the part it became a running joke that I should bring a bed to the practice space.
I never knew the term “incubation” existed for it. Good to know!<p>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.<p>Sometimes it’s pretty interesting to see how the “specs” of the problem change before and after solution.
I was introduced to this concept as a kid by "The Great Brain" book series. Was surprised to discover as an adult that it actually works in many ways. I'm a huge proponent of sleeping when I'm stuck on something. The tricky part is recognizing when I'm in an unfruitful debugging session and pulling myself away.
Cormac McCarthy wrote an interesting, somewhat speculative essay about this idea in 2017: <a href="https://nautil.us/the-kekul-problem-236574/" rel="nofollow noreferrer">https://nautil.us/the-kekul-problem-236574/</a>
This is the diffuse part of learning and I thought it was general knowledge by now? <a href="https://www.coursera.org/learn/learning-how-to-learn" rel="nofollow noreferrer">https://www.coursera.org/learn/learning-how-to-learn</a>