Live data from Hacker News

How to Program in Your Sleep

bellmar.medium.com

41–50 of 52 posts

Re: How to Program in Your Sleep

#41

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. 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 conscio…

in my own experience i feel like my subconscious mind does most of the problem solving and my conscious mind is mostly used for identifying the problem, selecting the input data, and then observing the result. if you flip your perspective you might also consider that while you are using your brain to program a computer you are also using the computer as a tool to program your brain. what makes computers so unique is that they give you the ability to control the input to the audio/visual centers of your brain so that you are able to manipulate the stream of information that is passing through your (very limited) short term memory. typing plays an interesting role here as well because there is subconscious muscle memory and so once you practice enough you write code the same way a musician plays a piano which is subconscious reaction between visual symbols and muscle memory. whats different with computers is that instead of reading from a printed music sheet you are able to control the sequence of visual symbols that trigger the subconscious muscle memory reactions that result in typing.

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.

Re: How to Program in Your Sleep

#42

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. 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 conscio…

> 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.

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.

Re: How to Program in Your Sleep

#43
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.

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.

Re: How to Program in Your Sleep

#44

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 id…

>> a fresh new idea to try

Yes. The solution sometimes come as well, but the fresh new idea almost 100% of times after a power nap or something.

Re: How to Program in Your Sleep

#45
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.

Re: How to Program in Your Sleep

#46
post #43

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. 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…

I'll push back because, in my experience, this sensation arises in the still-very-tired aftermath of totally spending myself on a problem.

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.

Re: How to Program in Your Sleep

#47
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.

Re: How to Program in Your Sleep

#48
I found myself assaulted by the evil twin of incubation.

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.

Re: How to Program in Your Sleep

#49
post #43

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. 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…

Pianists who slept longer can perform better than whose who waked up earlier to practice (source: some popsci book) i.e., perhaps sleep does more than just decreasing fatigue.
Post reply on HN