TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to Program in Your Sleep

99 pointsby mbellottiover 1 year ago

19 comments

ilakshover 1 year ago
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&#x27;t aware of.<p>One aspect of this that hasn&#x27;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&#x2F;solutions, giving you a head start on solving it.<p>As an aside, it&#x27;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&#x2F;solution spaces.
评论 #37282691 未加载
评论 #37283439 未加载
fasterikover 1 year ago
Along similar lines, there is Rich Hickey&#x27;s talk &quot;Hammock Driven Development&quot;:<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=f84n5oFoZBc">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=f84n5oFoZBc</a><p>Also Polya&#x27;s How to Solve It, referenced in that talk:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;How_to_Solve_It" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;How_to_Solve_It</a>
dkjaudyeqooeover 1 year ago
I had an fairly extreme version of this. I went to bed one night after feeling defeated because I thought I&#x27;d made a fundamental design error and my core data structure was broken and it couldn&#x27;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&#x27;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&#x27;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.
sinuhe69over 1 year ago
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.
评论 #37282278 未加载
macNchzover 1 year ago
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.
评论 #37281392 未加载
评论 #37279538 未加载
评论 #37281133 未加载
评论 #37280013 未加载
评论 #37280334 未加载
euroderfover 1 year ago
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.
评论 #37283817 未加载
paulmdover 1 year ago
Going for a walk often helps too. My campus had a nice place to walk and I&#x27;d often go for a spin and just relax and think a bit. If you&#x27;re really stuck or totally off track go for a long one.<p>Don&#x27;t use your phone, experiencing the walk is the point. Watch and walk and think.<p>The idle mind can be very fruitful, it&#x27;s a shame that we&#x27;ve let attention machines steal this. Not that I&#x27;m any better.
Towaway69over 1 year ago
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 &quot;backgrounding&quot; problem solving to the subconscious.<p>Which in a way, the author is indirectly describing. Engaging in activities that are &quot;automatic&quot; (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&#x27;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 &quot;I want to drink coffee&quot; or it might just have been a feeling between messaging and eating a breakfast toast!
评论 #37281588 未加载
评论 #37281736 未加载
liendolucasover 1 year ago
What a clickbait. Calling this &quot;how to program in your sleep&quot;? I mean, seriously? Everyone with sufficient experience knows that putting aside a problem that you&#x27;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.
评论 #37280443 未加载
whatamidoingyoover 1 year ago
So many interesting articles I&#x27;m never going to read because of the paywall. I&#x27;m curious how people who see this actually create an account to gain access?<p>I personally don&#x27;t think it&#x27;s worth giving up an email address and spending the time to do so to read a blog post.
评论 #37279219 未加载
评论 #37279098 未加载
评论 #37279218 未加载
评论 #37279242 未加载
评论 #37281101 未加载
评论 #37280661 未加载
mongolover 1 year ago
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 &quot;flying in&quot; 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.
评论 #37280262 未加载
chatgidipiover 1 year ago
I expected something more insightful. As someone who don&#x27;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&#x27;re tired, don&#x27;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&#x27;s still daylight, but ofcourse it depends on where you live)<p>- Don&#x27;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
dcanelhasover 1 year ago
I&#x27;ve been led to believe that the reason why a lot of written exams include the instruction &quot;read all questions before starting on the problems&quot; is due to this subconscious &quot;cooking on the back-burner&quot; effect. Problem solving in your sleep might be related to that strategy. I haven&#x27;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.
评论 #37280899 未加载
dec0dedab0deover 1 year ago
Many years ago I played drums in a band, and often the guitar players would write weird little off time parts that I couldn&#x27;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.
SV_BubbleTimeover 1 year ago
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.
评论 #37279834 未加载
anderspitmanover 1 year ago
I was introduced to this concept as a kid by &quot;The Great Brain&quot; book series. Was surprised to discover as an adult that it actually works in many ways. I&#x27;m a huge proponent of sleeping when I&#x27;m stuck on something. The tricky part is recognizing when I&#x27;m in an unfruitful debugging session and pulling myself away.
tehnubover 1 year ago
Cormac McCarthy wrote an interesting, somewhat speculative essay about this idea in 2017: <a href="https:&#x2F;&#x2F;nautil.us&#x2F;the-kekul-problem-236574&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;nautil.us&#x2F;the-kekul-problem-236574&#x2F;</a>
lang255over 1 year ago
<a href="https:&#x2F;&#x2F;www.nytimes.com&#x2F;1988&#x2F;08&#x2F;16&#x2F;science&#x2F;the-benzene-ring-dream-analysis.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.nytimes.com&#x2F;1988&#x2F;08&#x2F;16&#x2F;science&#x2F;the-benzene-ring-...</a>
tru1ockover 1 year ago
This is the diffuse part of learning and I thought it was general knowledge by now? <a href="https:&#x2F;&#x2F;www.coursera.org&#x2F;learn&#x2F;learning-how-to-learn" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.coursera.org&#x2F;learn&#x2F;learning-how-to-learn</a>