Major support for MindShift comes from
Landmark College
upper waypoint

What Can Programmers and Writers Learn From One Another?

Save ArticleSave Article
Failed to save article

Please try again


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.

lower waypoint
next waypoint