Dall-E created image of man having difficult conversation with two rubber duckies.

Zen and the Art of Programming

Part 1: Notes on the Work to Be Done


1. Chop Wood, Carry Water

Somebody in the long history of Buddhism said: "Before enlightenment: chop wood, carry water. After enlightenment: chop wood, carry water." Some say it was an eighth-century Chinese poet named ­Layman Pang, who declared that his “supernatural power and marvelous activity” was “drawing water and carrying firewood.” But whether Layman Pang put it in exactly the terms that have been distilled into the koan, or not, is in dispute.

A modern Zen practitioner interprets this not literally—most of us in the modern world don't chop wood for heat or carry our drinking water from a well—but instead to mean that the practice is, simply, to do the work that is to be done.

I am not a Zen practitioner in any formal sense of the term. Perhaps you could call me Zen-curious. Although I have meditated in a pseudo-Buddhist way for years, I am suspicious for, I think, some very good reasons, of all formal religious practice.

2. On Learning

Once, when I was a teenager, my mother told me I might have problems in life because I was interested in too many things. One day I thought I might be a lawyer, the next a musician. College seemed like a waste of time to me: why specialize, when there were so many things out in the world to encounter?

But later, the real problem: I got it in my head that I would be a writer—that I would, indeed, specialize—so while doing restaurant work, landscaping, tutoring, copywriting, anything to make a living, I earned a bachelor’s degree, then an MFA. Then I began teaching at the University of Pittsburgh, where I stayed on and taught writing for a few years after graduating from the MFA program there. I was thirty, and it was my first job that came with proper health insurance, even if the salary was, to put it generously, a pittance.

3. Disillusionment and Dissatisfaction

When I first entered the academy, I was thrilled. A place full of people who were committed to ideas! To the crafts of thinking, of writing, of political action! But that illusion crumbled quickly. For all the virtue-signaling leftism of American university culture, it’s striking to me how much of the actual work is done not by lauded tenured professors but by their poorly paid non-tenured colleagues or graduate students. In fact, it was a running joke amongst some of us that once a professor achieved tenure, it was as if they had died: we’d probably never see them again.

The pandemic further disillusioned me, as I watched the university administration stingily protect an endowment in the billions, claiming they were saving it for an emergency. Meanwhile, all of us clamoring for hazard pay, or at least a small bonus for spending the summer both working our extra jobs to fill in our meager pay and also adapting our courses to work within a remote context, and many of us also protesting racial or housing injustice, were screaming: but if this isn’t an emergency, then what the fuck is?

4. Giving Up

So, I gave up on academic work, and, although I still write every morning, I gave up the narrow idea of myself as “a writer,” full stop. After the 2020–21 academic year, while I was still paid through the summer months, I taught myself to write JavaScript. My partner had similarly gotten fed up with her job processing insurance claims, and attended a four-month programming boot camp at the same time. We were living on the last few paychecks of my small teaching salary and savings, and there was a clock on the money. We began this process in May, and calculated that at least one of us needed a job by October at the latest.

5. Frustration and the Rubber Ducky

Learning to write code is a humbling process. You are learning a new language, with its own syntax and conventions. Within your chosen language—JavaScript, for me—you also have frameworks and libraries, things that other programmers have built on top of that language, whose syntax and conventions you have to learn. You need to learn to read the genre of writing known as “documentation,” which is often out-of-date or poorly written. And, ultimately, you need to develop a relationship to difficulty that allows you to not understand everything and be okay with that. It probably says a lot about me that I continue to choose fields, namely writing and programming, that are defined by difficulty and ambiguity. I am terminally bored by things and ideas that are easy.

During that summer, I would sit at my desk for hours a day, trying to solve some coding challenge or follow along with a tutorial, and I would inevitably get stumped. My code wouldn’t work as expected, my application would crash where the example in my tutorial worked perfectly, or my code linter would throw errors that I did not then have the knowledge to parse. I tended to internalize this frustration, to ask myself whether I was an idiot or what? Why couldn’t I just get it? Why couldn’t I breeze through writing a React component like the teachers of the courses and tutorials I followed along with online? Why was I the one who would make little syntax mistakes that broke my whole program? What if I never got it at all? What if the self-proclaimed computer nerds at my high school were right, and you had to be a math genius to even approach computing work? Would I have to go crawling back to the university and beg for my poorly paid job back?

But I figured out quickly that this is one thing common to all programmers. Everyone from the senior developer who is working on cutting edge features for which there is no precedent to consult, to me, at that time a total beginner, who once got stumped for an entire day just trying to create a webpack configuration file.

There is a convention in programming that I find fun: the rubber ducky. This convention is based on the idea of having a rubber duck on your desk while you work on a challenging problem. The idea is that by explaining your code and problem to the rubber ducky, it can help you find solutions. In other words, by verbalizing your thought process, you can often find the solution to a problem that you may have been stuck on for hours.

Ideally, there is someone else to ask: a senior developer; your partner, if they happen to also solve similar problems for a living; strangers on stackoverflow. But sometimes, none of those are an option, so you sit with your confusion and you talk to a rubber ducky.

If you have never tried this, it may sound ludicrous. Talk to a toy? What are we, children? But trust me, it works. (And not only for programming, by the way. When I am stuck on a piece of writing, I now do the same thing.) I think it works because you are talking with yourself, asking yourself questions, setting aside your preconceptions and idées fixe. You are allowing your mind to explore the problem from the perspective of a beginner: to sit there and admit to yourself that you are not an expert, you are stuck, or that an answer eludes you, is to open your mind to possibilities that you may not have considered had you remained narrowly focused on the nitty-gritty details of the problem.

6. Forever Beginning

One popular idea in modern Zen Buddhism is the notion of “beginner’s mind.” It is part of the title of one of the first widely read books on Zen published in the West—by Shunryu Suzuki— and, from my Zen-curious perspective, seems to be a dearly held teaching for most Zen practitioners.

The idea is that the beginner, not knowing what they do not know, possesses more potentiality than the expert, because the expert is narrowly focused and specialized. They see the “correct” way, which could be re-phrased as: what has worked in the past. And the better a method has previously worked, the more rigid the expert’s thinking. The beginner’s thinking, on the other hand, is elastic. It is submissive. It says to the work to be done: I am humble, and I am curious about what you might have to teach me.

A beginner’s mind is capacious, as though looking out in all directions from a plateau. Taking on a challenge—programming, writing, or otherwise—from this perspective is more effective, and more fun, than to approach it from the more limited perspective of the expert.

7. And Beginning and Beginning and Beginning

One of the more obvious similarities between writing and programming is that the blank page and the programming problem you haven’t solved before both require you to approach the thing with fresh eyes. If you bring your strategies that helped with the last paragraph or the last Jira ticket, you will find yourself locked in to a method that probably will not work with the new problem that presents itself.

If I am terminally bored by things that are easy, it is perhaps the opposite for me with processes like writing or programming that present new challenges every day. A sense of beginning fresh every time I sit at the desk. A daily reset to the beginning, to an ambiguity and an uncertainty—even though I now have a solid grasp on my tools—that is, to me, reflective of life, in all of its multiplicity and confusion.