The look on her face was frantic, her motions frenetic as she exited her office. Somehow I knew she would be approaching my desk. “What’s that?” I asked, removing my headphones and trying to remain calm. I already dreaded the answer. “The site’s down. No one can log on,” said our CEO again in a panic-stricken voice.
As I absorbed those words—words feared and loathed by developers everywhere—I opened the file where I suspected I’d find the culprit. I had a pretty good guess: the one I had just deployed to our production environment. Before long, our phone began to ring, the oncology clinics that depend on our software to care for their patients every bit as frantic as our CEO.
I quickly fixed the bug and committed the changes, watching anxiously as our deploy script spat out its log messages. I switched back to my web browser and refreshed. The page loaded successfully, and I went outside for some fresh air. I paced back and forth in front of our building, my hunched shoulders refusing to relax. The weight I felt on my chest constrained my breathing.
Like most of the colleagues I related this story to, this was neither the first nor the last time I sacrificed my own physical and emotional health for the fleeting promise of startup work: the chance to get in early in a company destined for an enormous IPO. But this time, my body’s warning signs were impossible to ignore.
This is your brain on four hours of sleep
I had always assumed that a brain scan taken while I worked would read like an aerial view of a forest fire: intense, bright orange and red activity engulfing the whole area. In reality, however, one region in particular is uniquely triggered. The prefrontal cortex, the roughly fist-sized, foremost region of the brain that sits behind the forehead on the left and right hemispheres, is at work when we sit at our computers and bang out code. Scientists note that this region is responsible for “executive function,” an umbrella term that includes everything from organizing and planning to goal setting, problem-solving, and abstract thinking.
The prefrontal cortex consumes a disproportionately large amount of energy for its size: more than six of every 100 calories you eat are reserved for this cerebral region, impressive if you consider the number of other bodily systems vying for that energy. Unfortunately for the typical startup worker, the performance of the prefrontal cortex is also directly linked to our sleep habits.
In a recent study from the Sleep Neuroimaging Research Program at the University of Pittsburgh School of Medicine, researchers found that the prefrontal cortex is preferentially impaired following a night of particularly poor sleep. In other words, the sleep-deprived brain diverts its resources away from more energy-consuming and higher-order regions like the prefrontal cortex and toward areas like the basal ganglia, which is responsible for vital life functions such as swallowing and breathing.
In other words, while you may think you’re building your advantage by skipping out on sleep in order to get more work done, your brain will eventually be too starved to be of use.
Fortunately, the brain can begin to be renewed after even a single night of what the University of Pittsburgh researchers refer to as “recovery sleep”—the deep, dreamless kind that leaves you sleeping until the afternoon on Saturdays.
This research seemed to confirm my own findings. I found that the cognitive toll of sleep deprivation was most evident when I was working closely with a coworker. In these pair programming sessions, I struggled not only to write coherent code, but to communicate the deeper intentions of my work. This was the point at which I became the most distressed: no amount of coffee could diminish the difficulty of putting words together.
Suddenly, I realized that something had to give. I was forced to come to terms with how unsustainable my work-life balance had become. At one point, I had thought that my capacity for productivity was limitless. But now both science and my own body were directly contradicting the myth of the superhuman startup worker.
Human, all too human
Coming to the realization that people have limitations is much easier than concretely recognizing our own. We spend so much of our time communicating with computers that it’s easy to begin expecting the same superhuman things from ourselves as we do from our machines. Extraordinary feats like 99 percent-plus uptime, a flawless ability to perform complex calculations, and a logarithmically expanding memory become our goals.
But in order to continue to work, I ultimately had to put a greater focus on taking care of myself. This turned out to be both more difficult and more rewarding than I had anticipated.
Knowing how self-defeating my cycles of lack of sleep and increased need for sleep were, I decided to propose a conference talk on this very subject. I knew that I would have to speak from the experience of having shifted the focus from software to my own well-being, and this talk would keep me accountable. When I received the invitation to speak, I had about three months to prepare, which allowed for a deep exploration of the effectiveness of my habits at work and at home.
My two immediate goals were to get a full eight hours of sleep every night and to explore meditation. I found sleep to be the easier of the two to implement, and after I came to terms with the anxiety of not learning quickly enough, I was able to sleep well regularly. But while I had always been drawn to the idea of meditation, I found it difficult to incorporate into my life consistently. It helped me to redefine meditation not necessarily as a religious or spiritual practice, but rather, a single-minded focus on one thing. In this case, my breath.
I found that running the automated test suite on our application’s Ruby code gave me a perfect opportunity to pull my hands away from the keyboard, place them on my knees, straighten my posture, close my eyes, and begin breathing deeply. Prone as I am to racing thoughts, this practice helped me not only manage the stress I felt during the day, but also to focus on a single train of thought more consistently. Once I found this window of time to meditate, more began to crop up: starting up my machine, waiting for my lunch to heat up in the microwave, watching my local server start the Rails environment. Anywhere I had time to check my phone, I had time to breathe.
It wasn’t the easiest habit to cultivate, though. At first, my immediate impulse was to check Twitter, open my email, or switch back to the code I was testing and try to anticipate a failure before reading the command line output. I thought these impulses were saving me from focusing on my erratic and sometimes chaotic thoughts, but I came to realize that over time, they were just adding to the chaos. The more often I overcame the instinct to switch immediately to a new task, the more prolonged my sense of calm was when I went to take deep breaths.
All work and no play?
To my surprise, this sense of calm led to an increased awareness of my level of work-related stress and its effects on my emotional health. That is, the slowing of my thoughts allowed me to pay especially close attention to my moods, my energy, my ability to engage and to communicate well, and the overall sense of personal satisfaction I derived from my work.
I had always enjoyed my job, and was exhilarated by the initial investment it required in forward-thinking technologies. Recognizing a dramatic jump in my learning curve from week to week had given me a profound source of motivation. But when I began meditating, slowing my thoughts to a speed at which they could form a coherent stream, I realized I was overwhelmed by all those extra hours. My emotional burnout was rivaling my sleep-deprivation-induced physical one.
In the long term, I believe—and the research I uncovered supports—that focusing on my emotional stability was perhaps more effective at ensuring my success as a developer than staying up all night reading books on object-oriented design patterns would have been. But in the interim, I started to miss the previous pace of my learning progression. I wondered if I would ever rediscover my passion for programming.
But I was also emerging from my shell, re-exploring the activities I used to love. I went out for drinks with friends. I played board games with my wife instead of incessantly reading JavaScript framework documentation.
I felt better than I had in months.
Finding harmony
Only in the past month have I begun feeling inspired again. I’ve started waking up an hour or two early each morning to explore some of the new topics in JavaScript that cropped up over the summer while I was taking a break from extracurricular exploration. My complexion has regained some of its color, and I feel both more motivated and less stressed at work.
I would love to say that this pause, this perspective-broadening sabbatical I took from the overwhelming workload of the web, fundamentally changed my career and the way I work. But ultimately, it can be difficult to justify spending too much time recovering from burnout when our industry continues to fetishize productivity and the breakneck pace of web technologies.
Like most things in life, it’s about striking a balance: an equilibrium between the frantic tempo of our industry and our own internal rhythms. This year, I learned that my body knows this balance—and it will help me find it if I listen.