“Coder’s High”: One Hit and You’re Hooked for Life!
These days I write more than I code, but one of the things I miss about programming is the coder’s high: those times when, for hours on end, I would lock my vision straight at the computer screen, trance out, and become a human-machine hybrid zipping through the virtual architecture that my co-workers and I were building. Hunger, thirst, sleepiness, and even pain all faded away while I was staring at the screen, thinking and typing, until I’d reach the point of exhaustion and it would come crashing down on me.
It was good for me, too. Coding had a smoothing, calming effect on my psyche, what I imagine meditation does to you if you master it. In his study Zen and the Brain, neuroscientist James H. Austin speaks of how one’s attention will shift into “a vacancy of utmost clarity, a space so devoid of the physical self.” I don’t know if programmers get all the way there, but their ability to tune out the world while working is remarkable. A friend and I had a loud conversation behind a co-worker while she was deep into coding, and not only was she not bothered, she had no idea we were there and didn’t respond to her own name. That is some serious suppression of sensory response.
There are coders who can inhabit this trance for a dozen or more hours at a stretch. I never had that level of stamina, but there are countless stories like the one about game programmer John Harris, who was immortalized in Steven Levy’s myth-making 1984 book Hackers. While working on an 8-bit Atari port of Frogger in the early 1980s, Harris said, “I glued my hands to the keyboard.” One day he started programming midafternoon, losing himself in work. The next time he looked up from the screen, he was surprised that it was still light out, since he thought he’d been working well into the evening. It was actually the next morning.
There’s a lot of talk about these kind of trancelike “flow” states of total absorption. I’m not convinced that they’re all the same, and for me, the coder’s high is qualitatively different from anything else I’ve experienced. Books, movies, games, and even writing will sometimes absorb me to that degree, but it’s a very different feeling. It’s not as real, it’s not as addictive, and it’s not as perfect. Or rather, it doesn’t have that promise of perfection (especially not writing), since the trance deceptively transports you to a perfect, orderly world of algorithms and code that the end result never quite matches—as consumers know too well.
I’ve never heard an artist describe a trance that measured up. Maybe they just don’t have the words for it, but creative trances seem far more like drug-induced stupors, in which things may seem clear at the time but are usually hazy fever dreams—for every “Kubla Khan,” there are a thousand awful poems and paintings born of these fever dreams that lack significance to anyone but their creator. Code may be buggy, it may need serious overhaul later, but it compiles, it works (more or less), and it’s the same outside the trance as inside the trance. After a minor writing trance, I’ll usually say, “This is going to need some serious editing.” After a coding trance, I’d say, “This is good stuff! That was seriously productive!”
The closest description of something like coder’s high from a noncoder I ever heard was from a chess player. He described how, in his most lucid moments of concentration, he could suddenly see the entire game laid out before him in his mind, all the possibilities for strategies and many of their upsides and downsides. It was beyond just a mental picture or movie, since it had more information than could be represented in any linear way. It was as though the linear, serial nature of his consciousness had broken down and he finally had access to the vast parallelized processes of the brain all at once. (Certainly the most frustrating moments of the trance were when I would realize I had to change code in five different places in five different files and had to wait for my fingers to make one change at a time.) I’ve also heard mathematicians also portray moments of thinking and insight in similar ways, where the depth of their trances reached a point that the entire logical system at least appeared laid out to them long enough that they could finally put two or three missing pieces together and generate a new insight.
But coding regulates that trance by linking it to an ongoing process of production and goal-directed achievement. Perhaps that is one of its most compelling qualities. Not only do you have the momentary high of total absorption, but it works in tandem with an exciting quest mentality, in which one is hunting perfection. “Coding” isn’t just sitting down and churning out code. There’s a fair amount of that, but it’s complemented by large chunks of testing and debugging, where you put your code through its paces and see where it breaks, then chase down the clues to figure out what went wrong. Sometimes you spend a long time in one phase or another of this cycle, but especially as you near completion, the cycle tightens—and becomes more addictive. You’re boosted by the tight feedback cycle of coding, compiling, testing, and debugging, and each stage pretty much demands the next without delay. You write a feature, you want to see if it works. You test it, it breaks. It breaks, you want to fix it. You fix it, you want to build the next piece. And so on, with the tantalizing possibility of—just maybe!—a perfect piece of code gesturing at you in the distance.
At its best, I could partly carry the trance with me away from the keyboard. One time I was so preoccupied with a small, tricky piece of server code that in my dreams I located a race condition (a very nasty bug) in the code. Panicked in the dream, I forced myself to wake up and check it. My dreaming brain was right; the bug was real. (I imagine coding geniuses have this happen every week or two, but it only happened once to me.)
After being absorbed into the virtual world of code, the real world can seem so unwelcoming in comparison. Code may vex and taunt you with perplexing behavior, but it always plays fair; there is always some explanation. And there is always beauty and elegance, at least until shifting demands and poor maintenance lay waste to your code. During World War II, the mathematician Godfrey Harold Hardy wrote, “When the world is mad, a mathematician may find in mathematics an incomparable anodyne. For mathematics is, of all the arts and sciences, the most austere and the most remote.” In spite of the practical applications of computers, coding can be awfully remote as well. There’s often little sign that the data and calculations relate to real people in the real world. What the data means is a matter for other humans; you’re only telling a computer how to process it, regardless of whether it’s Viagra spam or James Joyce’s Ulysses. You can often ignore the content, which is good because there’s a lot more of the former than the latter.
So why did I stop coding full time? I still ask myself that question fairly often. Burnout was one simple reason, as well as health reasons (it turns out evolution did not optimize humans to sit in front of a computer for hours on end). But the high also started to wane in intensity. Not so much the absorption, which was still as powerful as ever, but the constant cycle of building and testing started to feel less like Leveling Up and more like pushing a boulder up the same hill over and over. Still, when I’m fruitlessly racking my brains over the last line of a column in search of le mot juste, I look at my programmer friends, typing away in a focused trance, and feel both nostalgia and envy.