Geek Sublime: The Beauty of Code, the Code of Beautyby Vikram Chandra
The nonfiction debut from the author of the international bestseller Sacred Games about the surprising overlap between writing and computer coding
Vikram Chandra has been a computer programmer for almost as long as he has been a novelist. In this extraordinary new book, his first work of nonfiction, he searches for the connections between the/p>/b>/i>
The nonfiction debut from the author of the international bestseller Sacred Games about the surprising overlap between writing and computer coding
Vikram Chandra has been a computer programmer for almost as long as he has been a novelist. In this extraordinary new book, his first work of nonfiction, he searches for the connections between the worlds of art and technology. Coders are obsessed with elegance and style, just as writers are, but do the words mean the same thing to both? Can we ascribe beauty to the craft of writing code?
Exploring such varied topics as logic gates and literary modernism, the machismo of tech geeks, the omnipresence of an "Indian Mafia" in Silicon Valley, and the writings of the eleventh-century Kashmiri thinker Abhinavagupta, Geek Sublime is both an idiosyncratic history of coding and a fascinating meditation on the writer's art. Part literary essay, part technology story, and part memoir, it is an engrossing, original, and heady book of sweeping ideas.
Novelist Chandra (Sacred Games) explores the connections between the worlds of computer programming and writing, beginning with the fact that “oth writers and programmers struggle with language.” In a short span, the book offers much material to consider, leaping from a history of computer programming and a primer on logic gates and how these programs work, to a personal of Chandra’s writing life, to some serious philosophical inquiry into how the term “beauty” might be applied to programming. The latter thread draws mainly on the rasa-dhvani theory of aesthetic analysis (from Indian philosophers Anandavardhana and Abhinavagupta), and although the ideas presented are sometimes challenging, Chandra provides more than sufficient intellectual guidance. Chandra’s book calls for a fuller appreciation of the programming world, not only because of the exponentially growing roles software plays in our lives, but also because of the actual work programmers do; in fact, he says of comparisons between programming and other disciplines, “When programmers say what they do is just like what writers do, or gardeners, or painters, the error is that they aren’t claiming enough, the fault is that they are being too humble.” Chandra’s melodic prose further adds to the contingency of his ambitious ideas. This book is truly a relic of today’s day and age. (Sept.)
A fruitful exploration of computer-age aesthetics, when artists are making use of programming even as programmers consider themselves artists.“Poetry’s beauty is infinite,” writes programmer and acclaimed novelist Chandra (Sacred Games, 2007, etc.). True enough, but Windows Vista’s code is still infinitely kludgy, even if, as the author argues, the “iterative processes of programming—write, debug (discover and remove bugs, which are coding errors, mistakes), rewrite, experiment, debug, rewrite—exactly duplicate the methods of artists.” It is an argument that Chandra advances with great subtlety, though it perhaps does not help his case that most of his more extensive examples come from the corpus of Indian, and particularly Sanskrit, literature, which will make that argument sometimes challenging to follow for some readers. Gradually, the book loosens into what at times seem to be only marginally connected essays: Gender parity and code parity are much different things, and the bigness of epics such as theMahabharatais considerably different from the bigness of big data. Still, there is a charm to Chandra’s sometimes-exotic approach, even as he circles back to some of his central questions: What makes a poem beautiful? Can we use the criteria we employ to answer that question to evaluate a computer program as well? The answers he proposes occasionally open onto still other questions, as with this one: “When programmers say what they do is just like what writers do, or gardeners, or painters, the error is that they aren’t claiming enough, the fault is that they are being too humble. To compare code to works of literature may point the programmer towards legibility and elegance, but it says nothing about the ability of code to materialize logic.”An engaging exercise in interdisciplinary thought, both elegant and eloquent. Besides, who can resist a text that works karma, Marcel Duchamp and iterative programming into a single thought?
- Graywolf Press
- Publication date:
- Sold by:
- NOOK Book
- File size:
- 4 MB
Read an Excerpt
The Beauty of Code, the Code of Beauty
By Vikram Chandra
Graywolf PressCopyright © 2014 Vikram Chandra
All rights reserved.
public static void Main()
Even if you're the kind of person who tells new acquaintances at dinner parties that you hate email and e-books, you probably recognize the words above as being some kind of computer code. You may even be able to work out, more or less, what this little "Program" does: it writes to the console of some system the line "Hello, world!"
A geek hunched over a laptop tapping frantically at the keyboard, neon-bright lines of green code sliding up the screen — the programmer at work is now a familiar staple of popular entertainment. The clipped shorthand and digits of programming languages are familiar even to civilians, if only as runic incantations charged with world-changing power. Computing has transformed all our lives, but the processes and cultures that produce software remain largely opaque, alien, unknown. This is certainly true within my own professional community of fiction writers — whenever I tell one of my fellow authors that I supported myself through the writing of my first novel by working as a programmer and a computer consultant, I evoke a response that mixes bemusement, bafflement, and a touch of awe, as if I'd just said that I could levitate. Most of the artists I know — painters, filmmakers, actors, poets — seem to regard programming as an esoteric scientific discipline; they are keenly aware of its cultural mystique, envious of its potential profitability, and eager to extract metaphors, imagery, and dramatic possibility from its history, but coding may as well be nuclear physics as far as relevance to their own daily practice is concerned.
Many programmers, on the other hand, regard themselves as artists. Since programmers create complex objects, and care not just about function but also about beauty, they are just like painters or sculptors. The best-known assertion of this notion is the essay "Hackers and Painters" by programmer and venture capitalist Paul Graham. "Of all the different types of people I've known, hackers and painters are among the most alike," writes Graham. "What hackers and painters have in common is that they're both makers. Along with composers, architects, and writers, what hackers and painters are trying to do is make good things."
According to Graham, the iterative processes of programming — write, debug (discover and remove bugs, which are coding errors, mistakes), rewrite, experiment, debug, rewrite — exactly duplicate the methods of artists: "The way to create something beautiful is often to make subtle tweaks to something that already exists, or to combine existing ideas in a slightly new way ... You should figure out programs as you're writing them, just as writers and painters and architects do." Attention to detail further marks good hackers with artist-like passion:
All those unseen details [in a Leonardo da Vinci painting] combine to produce something that's just stunning, like a thousand barely audible voices all singing in tune.
Great software, likewise, requires a fanatical devotion to beauty. If you look inside good software, you find that parts no one is ever supposed to see are beautiful too.
This desire to equate art and programming has a lengthy pedigree. In 1972, the famed computer scientist Butler Lampson published an editorial titled "Programmers as Authors" that began:
Creative endeavour varies greatly in the amount of overhead (i.e. money, manpower and organization) associated with a project which calls for a given amount of creative work. At one extreme is the activity of an aircraft designer, at the other that of a poet. The art of programming currently falls much closer to the former than the latter. I believe, however, that this situation is likely to change considerably in the next decade.
Lampson's argument was that hardware would become so cheap that "almost everyone who uses a pencil will use a computer," and that these users would be able to use "reliable software components" to put together complex programs. "As a result, millions of people will write nontrivial programs, and hundreds of thousands will try to sell them."
A poet, however, might wonder why Lampson would place poetry making on the same spectrum of complexity as aircraft design, how the two disciplines — besides being "creative" — are in any way similar. After all, if Lampson's intent is to point toward the future reduction of technological overhead and the democratization of programming, there are plenty of other technical and scientific fields in which the employment of pencil and paper by individuals might produce substantial results. Architecture, perhaps, or carpentry, or mathematics. One thinks of Einstein in the patent office at Bern. But even the title of Lampson's essay hints at a desire for kinship with writers, an identification that aligns what programmers and authors do and makes them — somehow, eventually — the same.
* * *
Both writers and programmers struggle with language. The code at the beginning of this chapter is in Microsoft's C#, one of thousands of high-level programming languages invented over the last century. Each of these is a "formal language," a language "with explicit and precise rules for its syntax and semantics," as the Oxford Dictionary of Computing puts it. Formal languages "contrast with natural languages such as English whose rules, evolving as they do with use, fall short of being either a complete or a precise definition of the syntax, much less the semantics, of the language." So these formal dialects may be less flexible and less forgiving of ambiguity than natural languages, but coders — like poets — manipulate linguistic structures and tropes, search for expressivity and clarity. While a piece of code may pass instructions to a computer, its real audience, its readers, are the programmers who will add features and remove bugs in the days and years after the code is first created. Donald Knuth is the author of the revered magnum opus on computer algorithms and data structures, The Art of Computer Programming. Volume 3 of the Art was published in 1973; the first part of Volume 4 appeared in 2011, the next part is "under preparation." If ever there was a person who fluently spoke the native idiom of machines, it is Knuth, computing's great living sage. More than anyone else, he understands the paradox that programmers write code for other humans, not for machines: "Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." In 1984, therefore, he famously formalized the notion of "literate programming":
The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding, using a mixture of formal and informal methods that reinforce each other.
Good code, then, is marked by qualities that go beyond the purely practical; like equations in physics or mathematics, code can aspire to elegance. Knuth remarked about the code of a compiler that it was "plodding and excruciating to read, because it just didn't possess any wit whatsoever. It got the job done, but its use of the computer was very disappointing."
To get the job done — a novice may imagine that this is what code is supposed to do. Code is, after all, a series of commands issued to a dumb hunk of metal and silicon and plastic animated by electricity. What more could you want it to do, to be? Knuth answers: code must be "absolutely beautiful." He once said about a program called SOAP (Symbolic Optimal Assembly Program) that "reading it was just like hearing a symphony, because every instruction was sort of doing two things and everything came together gracefully."
We are now unmistakably in the realm of human perception, taste, and pleasure, and therefore of aesthetics. Can code itself — as opposed to the programs that are constructed with code — be beautiful? Programmers certainly think so. Greg Wilson, the editor of Beautiful Code, an anthology of essays by programmers about "the most beautiful piece of code they knew," writes in his foreword to that book:
I got my first job as a programmer in the summer of 1982. Two weeks after I started, one of the system administrators loaned me Kernighan and Plauger's The Elements of Programming Style ... and Wirth's Algorithms + Data Structures = Programs ... [These books] were a revelation — for the first time, I saw that programs could be more than just instructions for computers. They could be as elegant as well-made kitchen cabinets, as graceful as a suspension bridge, or as eloquent as one of George Orwell's essays.
Knuth himself is careful to limit the scope of his aesthetic claims: "I do think issues of style do come through and make certain programs a genuine pleasure to read. Probably not, however, to the extent that they would give me any transcendental emotions." But in the many discussions that programmers have about craftsmanship, elegance, and beauty, there is an unmistakable tendency to assert — as Wilson does — that code is as "eloquent" as literature.
* * *
"Hackers and Painters" provoked an equally famous takedown titled "Dabblers and Blowhards" by the painter and programmer Maciej Ceglowski:
It is true that both painters and programmers make things, just like a pastry chef makes a wedding cake, or a chicken makes an egg. But nothing about what they make, the purposes it serves, or how they go about doing it is in any way similar ...
With the exception of art software projects (which I don't believe Graham has in mind here) all computer programs are designed to accomplish some kind of task. Even the most elegant of computer programs, in order to be considered a program, has to compile and run. So just like mechanical engineers and architects, computer programmers create artefacts that have to stand up to an objective reality. No one cares how pretty the code is if the program won't work. The only objective constraint a painter has is making sure the paint physically stays on the canvas (something that has proven surprisingly challenging). Everything beyond that is aesthetics — arranging coloured blobs in a way that best tickles the mind of the viewer.
Paul Graham has been hugely successful as a programmer and venture capitalist, and his essays about technology and business are sometimes thought-provoking and insightful. But his writings about art are full of majestically fatuous statements delivered with oracular certainty: "One of the reasons Jane Austen's novels are so good is that she read them out loud to her family. That's why she never sinks into self-indulgently arty descriptions of landscapes, or pretentious philosophizing." And, "The paintings made between 1430 and 1500 are still unsurpassed." But for Graham's primary readership of programmers, these pronouncements are the foundational caissons on which his grand art-hacking equivalence rests. Ceglowski the painter is skeptical:
You can safely replace "painters" ... with "poets," "composers," "pastry chefs" or "auto mechanics" with no loss of meaning or insight ... The reason Graham's essay isn't entitled "Hackers and Pastry Chefs" is not because there is something that unites painters and programmers into a secret brotherhood, but because Paul Graham likes to cultivate the arty aura that comes from working in the visual arts.
My first response to Graham's programmers-as-artists maneuver was as exasperated as Ceglowski's, but after the initial irritation had passed I began to think about the specific aesthetic claims Graham was making for code, about what kind of beauty code might possess, and why Graham would want to claim the mantle of artistry. Programmers already are famous, rich, influential. Why do they need any other auras? Ceglowski has a theory:
Great paintings ... get you laid in a way that great computer programs never do. Even not-so-great paintings — in fact, any slapdash attempt at splashing paint onto a surface — will get you laid more than writing software, especially if you have the slightest hint of being a tortured, brooding soul about you ...
Also remark that in painting, many of the women whose pants you are trying to get into aren't even wearing pants to begin with ... Not even rock musicians have been as successful in reducing the process to its fundamental, exhilarating essence.
It's no surprise, then, that a computer programmer would want to bask in some of the peripheral coolness that comes with painting, especially when he has an axe to grind about his own work being "mere engineering."
Ceglowski's evocation of the Picasso swagger natural to artists of course assumes that painters and rock-stars are charismatically male and women are (ideally) pants-less; that programmers are all men is such an obvious assumption that neither he nor Graham feels the need to qualify their assertions with a reference to gender. So it turns out — as always — that formulations of the aesthetic are embedded in specific histories and cultures of power, privilege, gender, and "cool." This particular landscape of American programming is one to which I am a foreigner twice over; I am a writer from India, but I've worked professionally as a programmer in the United States. Fiction has been my vocation, and code my obsession.CHAPTER 2
LEARNING TO WRITE
I came to computers while trying to run away from literature. I first published fiction — a plotty little sci-fi story heavily influenced by Isaac Asimov — when I was twelve, in a student-run magazine at my boarding school in India. Until then, reading stories and telling them (mainly to myself) had been a reliable, profound pleasure and a desperately needed comfort. The shock of seeing my secret life made public, in print, thrilled into my awkward, nerdy soul. I was a stereotypically budding writer, thickly bespectacled, shy, bad at cricket, worse at field hockey. When fellow students — even some of the remote, godlike athletes who were the heroes of my school — stopped me in the corridors to talk about the story and praise it and ask for more, I knew I had found a way to be in the world, to be of it.
So I kept writing. I read and, in various classrooms, imbibed a strange mix of Victorian classics, the great twentieth-century fictions produced by the stalwarts of Hindi literature, and fragments of Sanskrit from the epics. The only American texts we were prescribed were abridged, bowdlerized editions of Tom Sawyer and Huckleberry Finn. But in our dormitories, in the school-wide trading system for leisure-time reading, the most avidly sought prizes were the now-forgotten Nick Carter novels, featuring an eponymous "Killmaster" for AXE, "the smallest and most deadly arm of American global [intelligence]." Nick Carter exuded a particularly American glamour. The riches of America gave him an endless supply of killing devices, to which he gave cool names: "Hugo," a pearl-handled stiletto made by Benvenuto Cellini; "Pierre," a minuscule gas bomb; and my favorite, "Tiny Tim," a low-yield nuclear grenade. Nick Carter's exploits with beautiful women were lingered over every thirty pages or so, in counterpoint to the killing, with a level of explicit detail that made James Bond seem fusty and prudish and, well, British. And our home-grown spies, who adventured chastely in Hindi on the pulpy gray paper of the jasoosis available at railway stations, were too unspeakably Third World-ish and provincial to pay even cursory attention to.
Excerpted from Geek Sublime by Vikram Chandra. Copyright © 2014 Vikram Chandra. Excerpted by permission of Graywolf Press.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.
Meet the Author
Vikram Chandra is the author of three highly acclaimed works of fiction, most recently Sacred Games, which won the 2006 Hutch Crossword Award. Chandra lives in Oakland, California and teaches at the University of California, Berkeley.
Most Helpful Customer Reviews
See all customer reviews