10 ms·
Ask HN: Does anyone dream of code?
I have been having this problem lately. When I close my eyes and try to sleep my mind wanders and soon enough I am thinking about code, programming mentally. And I wake in the middle of the night and I am still mentally coding in a semi hypnotic state. I have slight OCD if that matters. Does any one feel the same? It is as if my mind never turns off.
- krapp 10y agoI actually can't sleep if I think about code. My mind fixates on it so much that it keeps me awake. When I'm awake and bored, though, I do think about code a lot, and game mechanics, and such.
- crottypeter 10y agoWho doesn't?
- tartuffe78 10y agoI don't, FWIW.
- wje 10y agoI don't.
- mymistrmister 10y agoThis is true for everything in life. Do some thing alot, and your mind will start processing it while you are asleep. I used to have such dreams about EverQuest. So I eventually realized I should play less :P It's called the Tetris Effect, read: https://en.wikipedia.org/wiki/Tetris_effect https://en.wikipedia.org/wiki/Tetris_effect
- Insanity 10y agoYup, I had the same for Jedi Knight, Counter-Strike, Left4Dead. With Left4Dead I had it particularly bad, when I would walk to school in the morning - still half asleep from playing until late the night before, I would "hallucinate" the sounds of the game. Even though I stopped gaming somewhere during university, I still have dreams about those games every now and then. OT: Just like other's in this thread, I have dreamed about code as well, with a similar frustration to wake up knowing the beautiful solution was all imaginary :-)
- RangerScience 10y agoFirst and most intense time this ever happened to me was from playing the origin Alpha Centauri. It was ultimately a deeply uncomfortable experience.
- wapz 10y agoI must have had the literal tetris effect. I played so much (competitively) I would dream of the patterns and pieces all the time. That's when I knew I was playing too much.
- numinary1 10y agoAll the time
- sanxiyn 10y agoI sometimes do. It is particularly satisfying when I debug (correctly!) the code in dream which I struggled to debug while awake.
- josephcooney 10y agoYep. My subconscious often gives me very interesting "left field" type problem solving/troubleshooting advice during my programming dreams.
- Lordarminius 10y agoThis is not unusual. The brain processes and organizes information when we sleep, just that we don't all usually remember this happening. I find that I tend to think about things in my sleep on three occasions: 1 when the activity is new 2.when I am sufficiently stimulated and excited by the material. 3. when I am worried or upset This 'dream state'used to occur to me in the past when I actively played chess, when I was in school studying for exams and nowadays when I'm struggling with (and mastering) a new concept or paradigm in programming. Recognizing it for what it is - a process of deep archiving and reorganization, I have come to embrace it and even be happy when it occurs, since material I have processed in this way terms to be deeply ingrained in my memory for longer.
- b123400 10y agoI do. But it doesn't happen very often, and I don't hate it. The clearest memory I have, is when I was 15, debugging some hacky PHP codes for days still unable to find a solution. I dreamed that piece of code and suddenly wake up with a fix, it was a pretty nice feeling. Also an year ago I started learning Haskell, despite reading a lot of tutorials I wasn't able to understand what a monad is. One day I woke up and find myself understood the concept. I don't remember the content of the dream, but it was a sweet dream and I slept longer than usual. I am not sure if I have OCD, but I like coding so dreaming code is not an issue for me.
- stephschie 10y agoI can't read in my dreams. I'm able to dream that I'm reading but the whole understanding of what the text actually should transport isn't there.
- Grangar 10y agoIn my first years of college I was a semester behind. I made up for that in 2 weeks of Christmas break. That was the first and last time I dreamt of Java.
- malux85 10y agoYes, this is quite common. Different types of code dreams are common too - code nightmares where you get caught in small, infinite loops or are unable to escape oscillation between a small set of bad operations Or happy code dreams where you float above the system and observe high levels of interaction and execution, watching data flow like water, and execution happen rythmically like beats of music.
- tluyben2 10y agoYep. I love it when that happens. Happens especially when writing complex code instead of just rattling off CRUD. The best time was when I worked for months on a Prolog project for uni, every day, all day with very complex concepts to crack. During the day when I went outside, my brain transformed everything in Prolog clauses; cars, roads, houses, bikes, people talking to me. And at night my dreams were in code as well. I now have it when doing embedded code or game code. Edit: Come to think of it, this 'free shrooms' experience is reason enough to not do CRUD apps :)
- dbattaglia 10y agoYes, but not in the literal sense for me. I never see any text or code but rather some abstract version of the problem I'm trying to solve. I dislike it to be honest, it makes me feel like I'm not getting any rest, especially when I wake up in the middle of the night from a code dream only to continue in that loop while I'm half awake. One time I went to sleep after starting a take home code test for a job interview; I woke up a few hours later having some intense dreams about it and ended up knowing exactly what to do. I finished it at 4am. I didn't end up getting the job, but they said during the interview they really liked the code.
- dsacco 10y agoWould you mind sharing why they (said they) ultimately chose not to extend an offer? Just curious about an anecdote from a hiring/recruiting perspective.
- dbattaglia 10y agoThey never gave a reason. That said, I felt like the interview with my potential team mates (one of the 3 interview rounds that day) really did not go as well as I would have liked. I could have done better describing my current work and projects. We did some whiteboard design question and ran out of time, looking back I could have done a lot better on that had I put more thought into it. I'm not bitter or anything, it was not my best in person interview by a long shot.
- CrossWired 10y agoOnly when deeply immersed into a problem. Day to day work doesn't really get it going for me, but if its something challenging I'll see all kind of code in my dreams, I've woken up with 'aha' moments too.
- Singletoned 10y agoElectric sheep?
- jon-wood 10y agoI occasionally do, but it always seems to take the form of finding a really good solution to a horrible bug. Then I'll wake up full of joy at having fixed the bug only to realise it was one entirely imagined during my dream.
- mike-cardwell 10y agoI have written code practically every day for the last 20 years. No, I never dream about coding.
- twfarland 10y agoYep, and it's not pleasant when you're lucid enough to know you're dreaming, but not lucid enough to be able to reason properly. It's just a general feeling of trying to solve something, without any payoff.
- aethertron 10y agoI've had several experiences of pointlessly struggling with a dream computer, or a more abstract sort of programming-flavoured dream puzzle. That's where you want to get lucid enough to realise that struggling with the problem isn't a worthwhile pursuit now, and go do something fun instead :)
- Gophyr 10y agoI try not to write code for about an hour or so before going to bed. I find that if I work on code, especially a complicated problem, I will dream about finding a beautiful solution (without actually seeing or remembering what I do). It's really annoying to wake up and realize it was all just a dream.
- mseidl 10y agoI never really dream of code, but I did have a funny dream of me writing something and trying to get girls to check out what I wrote. I was like, "hey ladies, check out this code"
- not_real_name 10y agoI think that's # 5 in "Top 10 Worst Pickup Lines ever"... ;)
- bryanrasmussen 10y agoSometimes if I've been doing a lot, also sometimes I have dreams where the dream is just code scrolling in front of my eyes. This second type of coding dream generally happens if I'm doing more than 10+ hours a day of a very verbose language.
- pigpen34 10y agoI started out in system administration and network engineering before switching to programming. I once had a dream that my cigarette needed an IP address before I could smoke it.
- paulmd 10y agoyou have to issue before you can consume
- deleted 10y ago[deleted]
- benchaney 10y agoI had a similar dream about my pants once.
- niceperson 10y agohaha
- trewq123 10y agoIPv6 here we come!
- Raed667 10y agoI remember waking up in the middle of the night and trying to call the remote control. (Most times I sleep with the TV on)
- angelofm 10y agoI think I am gonna write a Chef recipe to automate that, so we don't have to worry to assign those IP addresses, if I was you I would switch to IPv6 though
- user7878 10y agoHAHAHA
- relics443 10y agoWhen I go to sleep after having worked on something complex and didn't fully resolve it, I'll almost always dream about trying to solve it. Sometimes I see code, sometimes it's more abstract, but it's always disconcerting. My wife says I mumble things like, "I'm pretty sure 'also' is a keyword unless I'm losing my mind and need to check the documentation"
- emerongi 10y agoThe worst cases for me are with math-heavy problems. I'll see code mixed with shapes and graphs. The mornings suck, because you wake up knowing you were only half-asleep. That's why I like to play some easy games or read a book 1hr before going to sleep. Sometimes they induce creativity though and are counter-active.
- csorrell 10y agoI find myself dreaming in code far more frequently if I've left a problem unresolved. I never end up finding resolution in sleep though, and the problem I'm dreaming isn't usually related to what I'm actually working on. It's more like an exercise in working out the logic behind some kind of dream action, like walking or turning a door handle. I'll get stuck in a loop and go over it all night long trying to understand why is this not working!
- relics443 10y agoIn CS 101 I spent all night working on my final homework, walked into class, put the printed solution on the professor's desk, sat down in a desk right in front of his and fell asleep. I dreamt about the homework problem, and realized I had made a mistake. I immediately woke up, grabbed the paper, and made the correction. The whole class burst into laughter, but the professor didn't seem disturbed. Later he told me something like that happens every few years (he's been teaching for 30).
- deleted 10y ago[deleted]
- edw519 10y agoI've been doing this for 30 years. Why? Because I work in such a way to make it happen. What you call a problem, I embrace as a gift. Of all the things I've discussed here at Hacker News over the years, this is probably the #1 subject. Most programmers have the opposite problem of you: they have trouble turning their minds on. I always turn my computer off several hours before bed. The last thing I do every night is review hard copies of code with a red marker. Many nights I dream of my project/code. Sometimes I even jump up in the middle of the night and go to my computer, write down my thoughts, or lately, voice record them. Sometimes I am incredibly grateful for the "gift" I've received from "outside myself" in the middle of the night. Other times I'm annoyed. For every cool insight, there are many false positives: What was I thinking? But the positives far outweigh the negatives. I don't know why this works, but I can't imagine accomplishing all I do without it. Many programmers struggle for years to turn this "mind CRON" on. You already have the gift. I suggest you find a way to embrace it and turn your lemons into lemonade. You don't have a problem; you have a gift. Make it count! My original HN post: https://news.ycombinator.com/item?id=191275 https://news.ycombinator.com/item?id=191275 Also #49 here: http://v25media.s3.amazonaws.com/edw519_mod.pdf http://v25media.s3.amazonaws.com/edw519_mod.pdf
- smnscu 10y agoA lot of programmers I respect like to work on printed out code, and it's something I enjoy as well. Furthermore I'd love if we could work completely offline, with pen and paper.
- g00gler 10y ago> Furthermore I'd love if we could work completely offline, with pen and paper. Why is that? I loathe writing code on paper, seems like it'd be a serious regression.
- Lordarminius 10y agoReally? I have the exact opposite view. I love writing it my code on paper. It makes me feel like the creative part of the equation while I leave the 'mechanical' computation to the dumb machine. Debugging and understanding difficult code samples is easier too. I once read that Knuth(?) never used a computer and wrote everything on paper for his sectetary to type.
- luis_espinoza 10y agoI don't remember. So certainly was not properly documented.
- paulmd 10y agoYes, all the time. I was a military academy cadet and I train all the time in my mind, I dream 12-24 times a year that I have managed to get back in and do basic/etc. I was a TA and I prep/teach lessons in my mind, and I also slice and dice code in my mind all the time. I never know which I am going to get but coding is the most pleasant of them, by far. The higher my stress, the more likely it's not fun. The fact that my current job is to untangle legacy Java code and we actively oppose any "unnecessary" changes hurts me, because I can't not untangle it in my head, working or sleeping. Resting/playing is OK though. That's why it's important. Of course, we don't have any unit tests, because how else could we employ 2 testers per coder? And we obviously don't have any time for that useless stuff.
- reboog711 10y agoI used to dream in code all the time. It was when I was tackling a programming problem I was having trouble with. My mind would often solve it while I sleep; and I'd be able to solve the issue quickly in the morning. It happens less these days. Either because I am more experienced or because development tools have improved; I no longer get stuck like I used.
- lordkrandel 10y agoI don't. I had dreams about my workplace, but it never happened to me to dream myself at the desk writing on a keyboard. Funny, I'm on a computer up to 10 hrs a day. I always dream about people, and I'm never alone in my dreams. Even when I'm breathing with trouble at night, I have someone trying to save me. Curious, it makes me feel less "isolated" now that I'm thinking about it.
- smnscu 10y agoWhen I was cramming for exams in university I used to dream chemical equations. I also sometimes dream of code and how to architect various stuff I'm working on, which feels pretty good.
- jagjotsingh 10y agoIt happens all the time, not particularly because I am stuck on a problem. Happens the most when learning something new and your mind wanders into a playful state.
- sappapp 10y agoTry reading fiction before bed. I used to spend time thinking about code before sleep. The long term effects is the larger problem. Not giving your mind time to do something else will eventually lead to burn out. Credits to Tim Ferris for this routine.
- song 10y agoHa, I've never ever been able to start reading a good fiction book before sleeping without either ending up finishing the book and not having slept at all or passing out from exhaustion in the middle of the night after I notice that I've reread the same line 3-4 times.
- keyboardhitter 10y agoI tried reading before bed. Before I knew it, I would become ridiculously tired any time I tried to read (fiction) in the daytime. It was frustrating! So, now I read at lunchtime instead.
- bbotond 10y agoSometimes when I'm stuck with a hard problem, I find the simple and obvious solution in a dream. This happens most often when the problem is algorithmic. When I struggle with modeling problems, I often solve them in the trance-like state right before falling asleep. These solutions are much more elegant than what I would be capable of while being fully awake.
- FesterCluck 10y agoI've had this problem before. I dream as a javascript runtime vm, compiling the code as it's thought of. Infinite recursion hurts, literally. Other than that, if I'm lucid of the dream I rarely solve problems, just repeating the same road blocks over and over.
- nunez 10y agoWhen I'm really in the weeds of a problem, then yes, I do.
- Xophmeister 10y agoJust two nights ago, my wife came to join me, which woke me into a half sleep. I immediately grabbed something on my nightstand that reminds me of her and thrust it into the air, then I started to try to explain (somewhat incomprehensibly, apparently) the unit tests that would run against her. That's not a euphemism and the waving the thing in the air, I think, made me believe that her unit tests would run first, so I could get back to sleep sooner. Needless to say, she's still laughing at my antics!
- tupshin 10y agoMock the wife
- random_upvoter 10y agoOnce during a bout of fever I dreamt I was a running Pascal program. Believe me, it's no fun being a computer.
- kant312 10y agoThank god I'm not alone :p Almost every time I have a fever, I end up dreaming about code or diagrams. Sometimes even live CSS coding. And yes, it's awful and you can't escape.
- csuwldcat 10y agoSometimes, more so in my early-mid 20s, I would dream about code/architecture issues I was having, and bizarrely, wake up with the solution. It was a trip when I realized what had happened, so I started napping when I got stuck and it actually worked a decent amount of the time.
- deleted 10y ago[deleted]
- Belphemur 10y agoWhen I started coding I took upon a task way over my beginner skills. I was working on a Minecraft plugin to give the player the ability to access a virtual chest. I had to dive in the code of Minecraft so deeply that I started dreaming of creeper exploding in my code.
- z0noxz 10y agoI have the same problem, with often abstract crazy problems involving myself as part of the equation. It could be writing a system that gives me the ability to sleep or close my eyes, but also real problems that I worked with earlier that day.
- ifoundthetao 10y agoI'm currently doing the OSCP, and I've been dreaming of buffer overflow attacks the past few days. It's encouraging too, because my dreams are accurate.
- deleted 10y ago[deleted]
- teilo 10y agoYes, but my dreams blend together code and the other people in my life in a bizarre manner which only makes sense inside the dream itself, but is otherwise ludicrous. It is as if I am trying to debug other people, which of course never works, and thus it inevitably turns into an anxiety dream.
- gibbitz 10y agoIn that state between sleeping and waking I am often debugging my inability to wake. It's not as though I'm sitting in front of a monitor, but the lines of code are my entire worldview and no matter what I change the alarm keeps going off. I guess if I were a better programmer I would dream that I was writing a program to extend the night...
- OJFord 10y agoOnly pattern-based stuff. I first noticed this with PCB layouts - I'd be moving parts and re-routing/prettifying manually for long straights and only 45deg corners. Also refactoring code, particularly in an aesthetic way as if making the style consistent/readable before doing something with it - shortening lines, aligning data structure entries, whatever. It happens if I play something like tetris before sleeping or while tired, too.
- Raphmedia 10y agoOnly when I'm stuck on something. I find myself working on it half asleep in my bed. It pretty much always results in finding the solution or at the very least a good lead.
- lpa22 10y agoI have this happen to me relatively often (about once a month). The best part about it is that I make meaningful connections and actually solve problems related to the code that I am envisioning, and I wake up and I am able to implement what I dream about. This usually only happens the night after a long day working on very mentally challenging problems, it rarely happens after easy days.
- 6DM 10y agoOnly once, when I was a little overworked in college. It was about the process of authentication and authorization.
- sarreph 10y agoInsanity is when you wake up screaming that your build failed, and then realise you weren't dreaming.
- pizlonator 10y agoWhen I'm hitting my stress limit, I dream in code. It's usually a sign that I need to slow down.
- adjwilli 10y agoUsually when I'm learning a new programming language or technique, and just at the point where I'm starting to grok it but still having challenges, I'll dream that I'm programming in that language. Usually a day or two after that, I'll feel like I've finally acquired that skill. I remember this very clearly happening when I was about 22 and was playing around with Javascript and AJAX calls. It happened a couple other times after that, I think when learning Objective-C for iOS too, and maybe once again when learning how NSLayoutConstraints work.
- VladimirGolovin 10y agoWhen I was learning Haskell, I had a coding dream with a twist. In that dream, I wrote small programs, compiled and executed them. The twist was that the result of the execution was presented to me in the form of physical constructs, composed of square hollow section pipes welded together. I would then walk around the structure, examine it, and wonder, why a particular part of the structure is welded to the whole structure diagonally, instead of a 90-degree angle. Must be a bug somewhere.
- zingermc 10y agoI had a somewhat similar dream where I had an epiphany that everything in the universe is controlled by code, which I had the privileges to edit for some reason. I remember typing some HTML (`<span style="color:red">` and `</span>`) to create these small physical blocks. Slapping the blocks on either side of any object would turn it red!
- hartator 10y agoSpan shouldn't be blocs! You are dreaming wrong! :)
- amingilani 10y agoYes, when I'm utterly engrossed in a problem, like when my routine is basically eat, sleep, work and repeat. I dream about it as well. It isn't limited to code, when I was a kid I used to wake up dreaming of Tiberium Sun, and Red Alert 2. It's lately been code though.
- Zelphyr 10y agoI had this happen a lot when I first started out but not so much anymore for some reason. One thing I remember that has always amused me is how I would dream about this amazing code. It was so amazing that I would simply have to wake up so I could write it down. But, the few times I could actually wake myself up, as soon as I thought about it (before it quickly faded away) I said to myself, "WTF was that? There's no way that would work!"
- otikik 10y agoI have done this from time to time, when I was really stressed, and working too many hours. Once my life went back to a sane pace, where I could enjoy some personal free time, the problem went away. Now I have a baby and I dream of diapers.
- wingerlang 10y agoNot code specifically, but I sometimes dream about humans in some form of "modular" sense. Like if their feelings would be contained in one class/part of a program, or their torso would be accessed via methods or something like that. As someone else mentioned, it's likely the tetris effect. I had a similar feeling while playing the game "triple" town where you want to match three bears items next to each other, I kept seeing items and people in terms of "are they next to each other" while walking around (especially when a bit of alcohol was involved).
- deepnotderp 10y agoI've dreamt extensively about deep learning.
- nstart 10y agoYep. Not so much the act of coding but weird abstract concepts around code. To the point where once when I was working with Chrome and Firefox extensions and trying to get notifications to work just right, I woke up from deep sleep, and in a daze started shaking my wife saying that the notification were attacking us because I had made an error in a loop (she related this to me the next morning. I couldn't remember it :D ).
- jrumbut 10y agoThis reminded me of a dream I used to have of getting into the car, opening up the Chrome developer tools, and using Javascript to drive.
- Lordarminius 10y ago> This reminded me of a dream I used to have of getting into the car, opening up the Chrome developer tools, and using Javascript to drive. An aside. Reading some of the hilarious comments here I am inclined to think they could be compiled into a bestselling nerd comic
- bbcbasic 10y agoThat's not a dream, it's a premonition.
- a3n 10y agoWhy is it a problem? Are you getting enough rest/sleep? Do you have enough control over your day that you can rest when you need to? Are you effective in your work and personal life (controlling for OCD)? If the answer to most of that is mostly yes, you're doing pretty well.
- RUG3Y 10y agoYes, only when I'm working on a project and spend significant time looking at code during the day.
- hosh 10y agoI have dreamed of code. There are times when it feels like I am patterning the dream space (each space has its own rules, plot, feel, etc). When I was working with Kubernetes intensely, I was moving around abstract "lego blocks" representing concepts. The space was black, 3D, no gravity. (I remember someone coming into the space to visit and I told her I'm still working on it...) There were times when I was trying to figure out something in the dream and a different mind-thread was hacking code that maps to the plot of the original mind-thread. I have walked in dream spaces where I took a corner off the happy path and watched the world glitch for a moment and start procedurally generating. There were dreams about startups, working in an office (I work remotely most of the time). Lucidity and clarity varies. Sometimes it is very clear, the visuals and the coding concepts I am working with are sharp. Sometimes they are fuzzy. It is occasionally lucid (how aware I am that I am dreaming). That "semi-hypnotic" state seems like it is not high on the lucidity spectrum. That's pretty normal if you are coding in a semi-hypnotic state while coding during the day. I usually meditate before falling asleep, try to offload things in my day's working memory. It's usually whatever I am binging on, whether it is coding, anime, or even martial arts or whatever. For example, there was a time when I binge watch My Little Ponies and saw the ponies cavorting in the phosphenes. I'm not surprise this happens with code.
- tmaly 10y agoI think this happened to me once. I try to read a little fiction right before bed to help get my mind off work and programming.
- bsvalley 10y agoI dream a lot about what I could do with the money I'm making from coding. It's never enough...
- gremlinsinc 10y agoI don't really remember my dreams, my wife says I'm coding in my sleep though, and if I'm working on a difficult problem I usually solve it instantly when I wake up... I think maybe I really DID solve it in my sleep...
- awinter-py 10y agoWhen I've been paged overnight, my alarm clock integrates itself into dream logic as something that has to be defeated so that I don't wake up. not sure if the role assignments are random (alarm = pager = evil).
- 40acres 10y agoI studied for an interview with Google late last year. I did a lot of algorithm and data structure exercises along with system design work. The study was intense for me, I spent about 3 hours a day working on problems in CLRS for about 5 weeks. I would dream of algorithms a few times a week and think about problems constantly. Unfortunately I didn't get the job but it was really interesting to experience how my mind operated when a large chunk of my attention was consistently focused on complex topics.
- madamelic 10y agoYeah, next time don't study. I am convinced that Google interviews are rigged. I got on the phone with an "interviewer" and he sounded like someone strangled his pet in front of him. I knew I wouldn't get past then because he didn't really seem at all interested in interviewing me. I wasn't like Homebrew Qualified but I definitely wasn't Fizzbuzz Unqualified.
- jcahill84 10y agoAbsolutely. It's hard to turn your mind off when you're thinking about something complex and rewarding. Some recent study I read said we sleep to forget, so maybe this is your mind's way of making sure you don't forget the progress you've made on whatever particular thing you're working on. I've found that watching some boring TV or having a drink (alcohol) before bed helps.
- amyjess 10y agoThis sounds like it's related to the Tetris Effect: https://en.wikipedia.org/wiki/Tetris_effect https://en.wikipedia.org/wiki/Tetris_effect I've experienced the same thing.
- smilesnd 10y agoOnly thing causing me to lose sleep is trying figure out how to turn code into cash.
- coldcode 10y agoLast night I dreamt about having to work in a programming environment where objects appears horizontally and operations appeared vertically like a timeline. On second thought it was more of a nightmare.
- _agdistis 10y agoI have plenty of dreams about problems I'm working on. I usually end up dreaming of a way to solve them too. Though I did have this one dream where I was able to open up a virtual console next to anyone I saw and could program them to do whatever I felt like. I could do this with just random objects too, not just people. That'd be an interesting game idea now that I think about it.
- 9214 10y agoelseheartbreak dot com
- lightblade 10y agoYup. This happens if I was coding right before bed with a problem not solved yet. Most of the time the dream was about me typing random things into the screen that doesn't make any sense.
- OhSoHumble 10y agoI had a dream that I had racked up a huge amount of money at a bar. In response to my exorbitant tab, the barkeep told me that he would not be able to charge me any money for it if I ran Kubernetes in production.
- antfarm 10y agoWhen I was working on large systems with lots of interconnected parts, I used to dream about them as navigating a building with lots of different parts and wings.
- nogbit 10y agoI write my best code in my head while riding my bike to/from work, in the shower or lying in bed falling asleep. Having extended times of being disconnected enables your brain to chew on things and come up with new things to try.
- keyboardhitter 10y agoYes, I call this "terminal brain". Issues that I want to fix, or things that I've been working on whirl in my head in an abstract 2d visual state - flashes of the colors I'm using in iTerm, and random words repeating over and over... vague imagery of tailing a log file... it feels like my mind is creating scenarios and trying to solve many things at the same time. I think it's both a blessing and a curse. On one hand, some days I wake up and immediately know how to solve problems, or I'll think of new things to try. I've also had many nights where I come to understand concepts from 'exploring' the whirlpool of vagueness. Solidifying the abstraction helps a lot, I guess. On the other hand, this phenomenon can be very distracting or distressing at times. I have a terrible memory of trying to have sex and all I could think about was Redis.
- cafard 10y agoNot uncommonly. The first instance I can remember was during an automata & formal languages class: I dreamt of cars pulling out of parking spaces and going back in, and on waking realized that it had to do with the pumping lemma for regular languages. Last night there was a coding dream, but I don't remember the details.
- segmondy 10y agoHow long have you been programming?
- nul_byte 10y agoI once got really ill and went into a high fever, the whole time in my head I was debugging myself with code, was very strange. Other then that I never dream of code, but sometimes when I am half asleep in bed I start thinking about issues and playing out scenarios I could try to fix something, or implement a new feature.
- wolfgang42 10y agoI've had this happen once, and it was not a pleasant experience. (Try setting a breakpoint on your own brain sometime and see how much you like it.) Kenneth Reitz, who wrote Python's requests library, went crazy[1] (his words) and had a similar experience, though his was psychosis-induced rather than fever-induced. > The earth represented an "ideal" logical volume of data (life), and the universe was the collective storage LUN. I was using Amazon's Dynamo algorithm to replicate life, with eventual consistency, throughout the universe by watering plants in the garden. Now, Amazon actually uses Requests to perform all internal API control operations for AWS, effectively making my code partially responsible for the operation of the internet itself. See the theme? [...] I was very keen to have the doctors and my family look up the Dynamo whitepaper, to prove the legitimacy of my quest. 1: https://www.kennethreitz.org/essays/mentalhealtherror-an-exception-occurred https://www.kennethreitz.org/essays/mentalhealtherror-an-exc...
- dfansteel 10y agoOften. I have, occasionally, actually implemented what I dreamt of. To date it's only worked once. Which, when you think about it, is pretty damn amazing.
- urs2102 10y agoI would have this dream that I could access the Lisp REPL that controlled my dream, but I would accidentally use the loop macro wrong and I'd be paralyzed in front of my computer for the rest of my dream, unable to kill the process. Actually terrifying thinking about it again. Made me very wary of live programming XD
- szaharna 10y agoall the time! I dreamt I was in a builder factory pattern and had a full on battle with team create(). I was on team build()
- sofaofthedamned 10y agoWhen I was 14 in 1986 writing Atari ST stuff I had something come to me in a dream. The ST had a notoriously slow text output system. The display was a bitmap and there was no hardware acceleration. Somebody called Darek Mihocka came out with 'Quick ST' which made the text display quicker than stock. As a newbie I wanted to beat this, so I learned 68000 assembly and did the usual optimisation - unrolling loops, precomputing bitmaps etc. I got faster than Quick ST but then he had an update which nearly doubled my speed. I did everything I could to work out what he'd done, including looking at the Motorola reference manuals, nothing came up. I was going crazy. Bear in mind these were the days when there was no middleware, it was you versus the hardware, and if they did it better it's because their code was better. So I went to bed one night and the 'move.p' opcode came to mind. I woke up and read about it - turns out this opcode took a 16 bit number and split it into 2 8bit codes and placed them 2 bytes apart. This matched the ST interleaved bitmap perfectly - I doubled my speed and beat Darek. So, yeah, a dream did actually improve my code. I do miss those days where decent code beat driver, middleware and other issues.
- bluebeard 10y agoIf you think the dreams are weird how about this. There was a period when I was was spending a lot of time writing code every day. And there were some nights where I'd fall asleep then partially wake up and look at the window to see light cast on the curtain in a way that would sometimes spell a message that helped me debug, figure out a problem, or discover a new technique. Or give me an idea for an operating system's logo...
- rs86 10y agoAre u bill?
- codePrady 10y agoThe first few years in my career when I'd code for a few hours non-stop then crash on the beanbag at my desk, I dreamt a lot of bug fixes, very few of which stuck in my mind after I woke up. It's basically the last thought I had before I went to sleep which affected my dreams all my life. If that last thought is code, then so is the content of the dream.
- SippinLean 10y agoSame here (also diagnosed OCD), this might be more related to your sleep hygiene though. No screens before bed, no coffee after lunch, learn to meditate, etc. Turning off your brain is a difficult skill to learn, it certainly got harder once my dev career was serious. Somewhat related: I dated a cellist who said she'd read music in her dreams.
- Raed667 10y agoNot always, but when I'm immersed into a project long enough and I'm thinking about all its problems all day long, I dream of "solutions". But this happens only in those periods where my day is basically 100% code.
- Arinerron 10y agoYeah. Most teens don't have dreams about code, but I do. I fall asleep thinking about some bug, and wake uo with a solution. Unfortunately, I sometimes forget it :P
- slantaclaus 10y agoHell yeah, stresses me out too. It probably even gave me hypoglycemia a couple of times When I was studying organic chemistry, I had some pretty cool dreams about aromatic molecules. Bank finance class gave me an extremely revelatory nightmare about interest rates once. Dreams about stuff you're learning are almost always constructive though. It's a good thing.
- deavmi 10y agoI think I experienced code once as a dream. More as a project design. Can't remember what it was though.
- chphipps 10y agoWhen I first started to learn to program, in the very first week, I slept very little. Not because I was up late at night working but because I was so enticed and interested in what I had been learning that my brain refused to stop thinking with that mentality. So yes, I do.
- csorrell 10y agoYeah, happens a lot if I go to sleep without enough down time after coding. My dreams have me going over code that is needed to perform some kind of dream action, like sitting, walking, or whatever else. I'll often get stuck in a loop and go over it again and again, trying to get the logic right all night long. My wife thinks it's hilarious because sometimes I'll talk in my sleep about it.
- tarboreus 10y agoThis is normal, and gamers also experience it. It's only an issue if it's interfering with your sleep regularly. You'll find that it's most acute when you're deep in a problem or learning something completely new. If you find yourself in a "loop," get up and read a few pages from a book that you're not too excited about (not code related, history or a novel). The dreams should recede when you're under less cognitive load during the day, which should happen as you learn in your role.
- slantedview 10y agoProgramming in your sleep or in the shower or any other place away from the computer is awesome, because it's often where you'll achieve a breakthrough (even in your sleep)! As Rich Hickey would say, slowing down and stepping away from the computer forces you to think more deeply about a problem and explore it more. I view it as a good thing, but it usually only happens to me when I've been deep in a problem for a while, so it's an occasional thing.
- unusximmortalis 10y agooooh yes, quite often :)
- adnanh 10y agoIt's your subconscious working on a problem... One example would be scenario where you can't remember some word, and you decide you can't remember it and stop thinking about it, your brain continues to search for it in the background (subconsciously)... and then the word comes to you like an interrupt. I had the same thing with studying for exams (I would dream of the lecture notes and when I wake up in the morning I can perfectly recall everything). There was a study posted at HN where not completing a task at work, leaves your brain working on it even after you leave your office, only to have the solution pop up in the middle of the night. All of this can be a result of a stress. You need to take a vacation and relax. Recharge your batteries or you'll be feeling drained really soon...