Proponents of stronger computer science and programming courses in schools generally focus on the usefulness of those skills in today’s world. Some argue that computer programming should be offered instead of a foreign language requirement, while others say it’s crucial to engineering and robotics. Rarely is coding considered a complement to the English curriculum. But what if learning to code could also make students better writers?

There are more similarities between coding and prose than meet the eye. “The interesting thing about writing code is you don’t really write code for the machine,” said Vikram Chandra, a professor of creative writing at UC Berkeley and author of “Geek Sublime,” on KQED’s Forum. “That’s almost an incidental byproduct. Who you really write code for is all the programmers in the future who will try to fix it, extend it and debug it.

A famous programmer, Donald Knuth, championed the idea of “literate programming,” the idea that code should be written for humans, not just machines. Knuth compared the programmer with an essayist, Chandra said, paraphrasing his argument. “Somebody who sits down with a thesaurus and tries to construct a script that is best for human understanding, not for computer understanding.”

And code, like powerful literature, can have a long shelf life. If it is well written, it can be built upon many times over. And poorly written code could still be the cornerstone of an important software program that no one understands. To Chandra, truly elegant code solves a problem simply and within the aesthetics of functionality. And therein lies the difference between code and an art form like writing.

“Making something beautiful is not the same thing as being an artist,” Chandra said. “There is a substantial difference in what you are trying to do with the beauty.”

The difference lies in the intention behind each form of writing. Fiction tries to evoke emotion or illuminate a human truth, whereas good code strives to be as denotative as possible. If a line of code leaves something up to interpretation it is not doing its job. “Code has to be designed for change in the future,” Chandra said. Coding, unlike most fiction writing, is essentially collaborative in nature. If computer scientists can’t follow the effects of the code through the machine, it becomes incomprehensible — a “big ball of mud,” in programmer lingo.

Chandra is clear that while code can be elegantly written and even beautiful in form, it does not reach the level of art. “I think you become an artist by making an object that rewards contemplation outside of functionality,” Chandra said. A poem is powerful both in what it says and what is left out; it requires the participation of the reader. “If you introduce ambiguity into code, you’re setting up a potential disaster,” Chandra said.

Still, as both a writer and an amateur computer programmer, Chandra sees parallels that might help blossoming writers and coders learn from one another. “When I’m writing a novel and when I’m writing code, I can see certain analogies,” he said. “For example, the composition of complexity by building simple objects and putting them together.”

In a work of fiction, the narrative and thematic structures are built upon paragraphs, composed of sentences, made of words. Code isn’t so different, except it has to be easier to break apart. “Each little piece of code that you write has one function that you can then test,” Chandra said. “And then you compose all these small bits of functionality to make greater functionality. It’s like putting together a mosaic or a jigsaw puzzle, but the jigsaw puzzle has to come apart very easily and then allow the replacement of some of the parts with newer parts.”


The digital world has come a long way in the last 40 years, but in many ways it still imitates analog equivalents, especially when it comes to education materials. E-books exist, but they are just that — electronic books — a digital form of a concept that has been around for centuries. The first books printed after the advent of the printing press looked a lot like manuscripts until people began to experiment more liberally with the new form.

Similarly, Chandra believes humans are still at the beginning of the code revolution. Programmers and users are still imitating what came before, and haven’t even imagined all that could be in the future. “There are certain possibilities in making narrative within e-books, but I still don’t have the tools to do it yet. It’s too difficult,” Chandra said as one example. In another, perhaps one day lines of code will literally take a three-dimensional form, becoming sculpture.

One thing Chandra is sure of is that code is a type of language, based on the same logic as Sanskrit, and for the first time in history language can change the physical world. That’s something literature has been trying to do for a long time. Think about it like this, Chandra said: “When I give you a piece of text to read, I’m handing you a script that you will run inside your own brain, that you will perform inside your own brain, and that will transform you.”

That might be just as good as transforming the physical world.

  • C. David Kearsley

    Regarding your illustration: Please do not confuse mathematics with computer “code”. They are not the same thing, and at a certain level, the symbolic representations of mathematics can be far more akin to poetry or musical notation…

    • Just because a poet or writer is not literate in code does not mean that the code a programmer makes can’t be beautiful and elegant.

      Code can even contain humor, as the programmer can choose whatever variable names they like, so long as they still make sense in context.

      • C. David Kearsley

        I actually agree, especially with regard to the construction of fanciful and/or humorous names for variables, classes, functions, etc. In fact programming “elegance” is a central tenet focused upon in the teaching of programming languages. My comment was initially and mostly concerned with the graphic illustration accompanying the article, which is a collage of mathematical expressions, not lines of computer code.

        • Davidson Kamal

          Si­­nce I started with my online business, I earn $62 every 15 minutes! My best friend ha­­s be­­en averaging 11k for months now, he wo­­­r­­k­s about 20 hours a week and convinced me to try. I can’t believe how easy it was once I tried it out. The potential with this is endless. This is what I do http://Workacademy/cash/online/report/Vip

  • id10t

    It’s ironic that a writer, not a programmer is trying to explain both sides. Where is the perspective of the programmer, written by the programmer? This sounds like a priest talking about marriage!

  • Jeremy

    What a poor argument. Just the first counterexample that immediately comes to mind is the JAPH phenomenon:

    • Kurtz

      I think that this article is garbage and that code can absolutely be “art” but the example you provided does not advance that notion, that stuff is just silly and superficial nonsense that does not require any programming knowledge to create.

      • Jeremy

        Haha, okay, please provide me with a thorough explanation of how the camel one works, then. All of those are executable code.

  • Ceegee Parfois

    Great work NPR, even reading this article I’m not only offended but astounded at how shortsighted this article is. Code *IS* art. I am a published Lyricist, a writer, a costumer, a painter *and* a programmer. Some may say that the code is the medium and therefore not art, but then so are the words you put down on your page. Writing code give me the same set of thrills the same set of “oh, this feels just right” as writing a graphic novel, or painting. Both require training, skill and the mind to be able to see something that isn’t quite there yet and turn it into reality. By the way you describe it, you are both denigrating programmers and code; and elevating art. Both are an expression of a way of thinking and being in the world, that can be intrinsic. Yes both art and code can be taught to be passable, but you tell me? How many times have you written a 300 page novel using only algorithms and half the English language, and made it comprehensible for the rest of humanity? Bah! I find myself saying “I just can’t” with this article. I’ll leave it to the hordes of other programmers you offend with this article, now..

  • Dot And Carry One

    Anyone who doesn’t think that “A *program* is powerful both in what it says and what is left out” isn’t a skilled programmer. I like the idea of this article, but I think that Professor Chandra has insufficient understanding of the art of programming.

    • Just because a poet or writer is not literate in code does not mean that the code a skilled programmer makes can’t be beautiful and elegant to one who is fluent in it.

      Code can even contain humor, as the programmer can choose whatever names they like for their variables, functions, etc., so long as they still make sense in context.

      And isn’t there something musical about repeating loops of logic that change subtly with each iteration based on the variables? It’s a bit like a dance.

      – I’m currently an Illustrator, but I used to be a Programmer.

    • jhoger

      Exactly what I thought. Often I come to a piece of code, refactor it to add new functionality, and there is less code there then when I started. That’s success.

      Code that does not exist cannot have a bug, and it cannot confuse.

  • Just because a poet or writer is not literate in code does not mean that the code a skilled programmer makes can’t be beautiful and elegant to one who is fluent in it.

    Code can even contain humor, as the programmer can choose whatever names they like for their variables, functions, etc., so long as they still make sense in context.

    And isn’t there something musical about repeating loops of logic that change subtly with each iteration based on the variables? It’s a bit like a dance.

    – I’m currently an Illustrator, but I used to be a Programmer.

    • Sorry for the duplicates. I decided to put this on it’s own thread, but apparently deleting where I put it on another thread merely deletes the author and switches it to anonymous. Now THAT seems to be an example of inelegant coding, when it doesn’t do what the user expects it to do.

      I’d just delete this one also, but I am not confident that it would actually delete it.

      • DizzleMcShizzle

        No worries, and well said.

  • misanthrope

    As a programmer, I can surely say coding is an art. You must make a very complex idea, simple and easy to understand. Is this now what writers do? There is much experience, skill, and fore-thought required for this to happen. Sure sounds like poetry to me.

  • DizzleMcShizzle

    Methinks the author hast forgotten in whose eye the art is fraughten.

  • Jan Van Bruggen

    “A poem is powerful in both what it says and what is left out; it requires the participation of the reader.” Therefore, we cannot consider Renaissance portaiture to be art, as any painter who left a spot of white canvas in the middle of the subject’s forehead was surely out of a job. “If you introduce ambiguity into [insert any modern medium considered more craft than art here], you’re setting up a potential disaster.”

  • Daniel Parry

    Donald Knuth wrote one of the foundational textbooks on computer programming called “The ART of computer programming.” I have a hard time imagining that the author is as proficient in computer science as what he seems to profess in poetry.

  • TatumCreative

    I consider programming to be poetry. Code is written for humans, even though it’s compiled down to machine language. Part of my work is trying to express how beautiful code can be. It’s difficult to relate that to a non-programmer and even programmers. I’ve created an entire series that explores the idea of code as poetry:

  • Will Rosecrans

    I quite like this article, but I have to take issue with the suggestion that code “does not reach the level of art.” Especially since the article seems to awkwardly omit the fact the Knuth is literally the author of “The Art Of Computer Programming,” despite being referred to in the article only as a famous programmer. I suggest the author look up things like the IOCCC, programming languages like bf and piet, or novelty programs like quines and reconsider the assertion that programming is strictly all about functionality. Even someone completely unfamiliar with the nuts and bolts of programming will have to appreciate the fact that the piet programming language is designed so that the programs can look like the paintings of Piet Mondrian. One example I saw computed a power function, and the program was in (roughly) the shape of an elephant since elephants are powerful. A recent IOCCC winner is an OCR program written in C as an ASCII art portrait of a fox jumping over a dog because “The quick brown fox humped over the lazy dog” is a sentence often used when testing OCR code’s ability to differentiate every letter.

  • In 1902, Bertrand Russell and Alfred North Whitehead, published Principia Mathematica, and advanced the theory that language conforms
    to mathematical treatment in the form of propositions. Understood this way,
    mathematics serves to frame an observation, a problem, a function or solution
    in terms that can be examined by anyone capable of understanding the language.
    The forms utilized in conveying mathematical information include equations,
    algorithms, biological sequences (gene sequences) and models. As such
    mathematics may convey epistemic objectivity about things that are
    ontologically subjective. Note however, that those biological sequences may
    have a mathematical form, but that the sequences also have a physical reality,
    an essential form utilized to manufacture protein. Its behavior is not open to
    interpretation. It is what it is. It has both epistemic objectivity and
    ontologic objectivity.

    What differs between a mathematical model. a program and a poem or a painting primarily has to do with interpretation. The meaning conveyed by a poem or a painting intrinsically remains subjective and therefore obviously interpretative. The meaning of any mathematical computation shares this same fate regarding its interpretative aspect. As for example, a computation performed on a computer. It is observer relative having no intrinsic meaning. If meaning exists, we must supply it. The recognition that mathematics can relate in a one to one correspondence with natural and artificial phenomena has resulted in the scientific method or a way of detailing the universe of things as a series of internally consistent mathematical expressions or sentences. To the positivist it forms the only true reality. Science says nothing about values and any interpretation of the deeper meaning is subjective.

    However, this may not be true in general and in respect to other objects, such as biological genetic expressions, we may be obliged to discover what if any intrinsic meaning exists—for this may be the clue to its goal or ultimate purpose.
    I suggest that to find this purpose we need to explore “use” and its
    cognates and connotations, not only in science, but in the social reality of our

    Computation, as carried out by an algorithm, in and of itself has no intrinsic meaning so we must provide an interpretation. Computation is observer relative. This is no different from thousands of other artifacts such as a book, a bed or a knife. We define something composed of pages containing writing, generally bound and inserted between a robust set of covers as a book. However, it might also be used to kindle a fire or used as a doorstop and defined as such. We can say what we want about its meaning or function in the world, it has no inherent function as
    does water to wet, or gravity to pull or charge to attract or repel other charges.

    For example, mere propositions whether we think of them as mathematical or linguistic cannot explicate the underlying formal structure of something, the thing that gives it value, telos or purpose. In a fundamental way science and technology has focused our attention away from purpose. We are mesmerized by molecular biology and the discovery that an organism’s characteristics are encoded by a four-letter alphabet, defining a language of three letter words that manufacture the
    twenty-proteins that confer life on our planet. Transfixed by that astounding
    discovery, we fail to understand that this blueprint says nothing about who we
    are or what we stand for. I may have house plans, complete with all the
    materials necessary to erect a fine structure, but they say nothing about what
    or whom lives inside or whether it will ever rise to that sacred place referred
    to as “home”. The “use” of this structure as a home represents a “statement” of
    higher purpose. That use described in a literary way, may convey something about who we are, unlike a computer program or mathematical statement.


Katrina Schwartz

Katrina Schwartz is a journalist based in San Francisco. She's worked at KPCC public radio in LA and has reported on air and online for KQED since 2010. She's a staff writer for KQED's education blog MindShift.

Sponsored by

Become a KQED sponsor