Do you dream in code?

Kiri Um
5 min readSep 25, 2020

When I enrolled in a coding boot camp, I knew that it was going to consume a ton of my time and be a lot of hard work. The camp advertised itself as being an “immersive experience” — and it was. I regularly had days where I was spending 12 hours or more working on my newly acquired craft.

About 2 weeks into the course, I woke up a little tired one morning with a funny realization. In my sleep that night, I had been dreaming about computer programming. I didn’t remember too many details, but I did recall visualizing a text editor on dark mode and I was typing some sort of neverending code into it.

Weird. I didn’t really think too much about it at the moment because people dream about crazy stuff all of the time. Flying, falling, working, losing teeth — the dream world is endless and the human mind can think of some pretty odd stuff.

What got me is that a couple days later I had another dream about computer coding. This time I did recall it being about a class lab requiring Ruby. I had been stuck on a problem the night before and I went to sleep feeling defeated. When I woke up in the morning, I was super eager to get back to the problem and solved it in a short amount of time.

These coding dreams started happening on a semi-regular basis. Man, I knew that this course was supposed to be immersive but this was a little crazy. I mentioned it to a few classmates in my table groups and found out that I wasn’t the only one. Other people have had similar dreams involving coding.

Upon further research on the internet, this seems to be a pretty common thing. People have reported various types of dreams. People reported everything from solving difficult problems in their sleep to having horrible nightmares.

One person on a forum pointed to the “Tetris Effect”, or also known as “Tetris Syndrome”. So I went to Wikipedia to learn a little more about this. Apparently when a person devotes so much of their time, energy and attention into something that it begins to pattern their daily thoughts, the way they imagine things, and also their dreams. This obviously was named after the video game from the 80s, “Tetris”.

People who spent a lot of time playing Tetris found that they were seeing the Tetris patterns in their daily life and some also reported visualizing playing the game while dreaming in their sleep. Those who were experiencing the Tetris effect found that they were unable to prevent the thoughts and dreams from happening.

The Tetris Effect was first referenced in a famous Wired article called “This is Your Brain on Tetris” by Jeff Goldsmith from May 1994:

No home was sweet without a Game Boy in 1990. That year, I stayed “for a week” with a friend in Tokyo, and Tetris enslaved my brain. At night, geometric shapes fell in the darkness as I lay on loaned tatami floor space. Days, I sat on a lavender suede sofa and played Tetris furiously. During rare jaunts from the house, I visually fit cars and trees and people together. […]The Tetris effect is a biochemical, reductionistic metaphor, if you will, for curiosity, invention, the creative urge. To fit shapes together is to organize, to build, to make deals, to fix, to understand, to fold sheets. All of our mental activities are analogous, each as potentially addictive as the next.

The Tetris Effect can also occur with other activities as well. “Sea legs”, where people who spend time on boats feel like their rocking when they are on solid ground is considered a form of Tetris Effect. Famous mathematicians have also reported dreaming of equations in their sleep. Apparently it can happen with computer coding as well.

After reading a little more about it, I realized that I have experienced the Tetris Effect while I was awake as well. For example, I was at a local sandwich shop one day, and while I was waiting for my sandwich, I started thinking about the promises, loops and conditional statements that go into making my order. Yes, I know, I’m a nerd. But it just shows that if you spend a lot of time with an activity you start seeing parallels to it in your everyday life.

Embrace it or suppress it? Yes, it can be nice to be so focused on your craft that you dream about it, but if it happens to you all of the time throughout your career, it could be a sign that your life is out of balance. For me, I was in a coding bootcamp, and this is what I signed up for. It’s meant to be intense, but temporary.

I read about somebody comparing writing code to building a glass house inside your head. It takes time to build all of your ideas for a project and connect them together in your mind. When you are “in the zone” and engulfed in your project, all of the technical relationships are really familiar and the way everything works together seems really clear to you. When you take time away from your project or lose focus for a moment, this “glass house” begins to crumble and fall apart. When you come back, it takes time to refocus on everything and rebuild your house. The longer time you take off, the more you have to rebuild.

As computer programmers, we generally have a desire to stay or “in the zone” on whatever we are doing because if we step away from it too long, it can take a lot of work and time to re-familiarize yourself with what you were doing.

I do remember another dream I had where I was stuck trying to build out some kind of complicated for-loop. It was not working for some reason and I kept going back to change things over and over again. I was stuck in an infinite loop trying to build a loop. At that moment I wished I could have used a “control-C” to get me out of it. I woke up exhausted.

Just like everything else in life, too much of something can be bad. If you regularly have poor quality sleep or are losing sleep on a normal basis, it’s obvious that’s not good for you. Your mind needs to rest, relax and reset. Not being able to get out of work mode when you go to sleep might mean that you are still in work mode all of the way until you wake up.

For some people, these sorts of dreams can be triggered by anxiety as well. Pressure to finish something on time, or being afraid that your work is not good enough can be the sort of thoughts that one can carry into their sleep. Being stressed 24 hours a day is also physically and mentally not good for you.

If you feel like the quality of your sleep is horrible due to thinking about coding all of the time and it is affecting your health, there are some things that you can do that may help. Instead of going straight to sleep after working on computer programming, taking some time to truly “unwind” by doing something else can get your mind off of coding. Try to do something that gets your mind to escape from your work. Also, don’t code into the early morning hours of the night if you don’t have to. Avoiding phone or computers screens before you sleep can help, and even meditation to clear your mind can be beneficial as well. Stay sharp, sleep well, and happy coding!

--

--

Kiri Um

Aspiring Software Engineer, Geologist and Geophysicist