Both writers and programmers struggle with language. Microsoft's C# (is) one of thousands of formal programming languages created over the last century. These 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 this 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. But he above all 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 formalised 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 silicone 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 that "reading it was just like hearing a symphony, because every instruction was sort of doing two things and everything came together gracefully."
* * * * *
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. Now the shock of seeing my secret life exist in public, in print, thrilled deep into my awkward, nerdy soul. I was stereotypically the 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 post-Independence fictions produced by the stalwarts of Hindi literature, and fragments of Sanskrit from the epics. The only American texts we were prescribed were abridged, bowdlerised 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 tiny gas bomb; and my favourite, "Tiny Tim," a low-yield nuclear grenade. Nick Carter's sexual adventures with beautiful women were lingered over every thirty pages or so, in counterpoint with the killing, with a level of explicit detail that made James Bond seem fusty and old-fashioned and, well, British. And our home-grown spies, who adventured chastely in Hindi on the pulpy grey paper of the jasoosis available at railway stations, were too unspeakably Third-Worldish and provincial to pay even cursory attention to.
During one long summer vacation at home in Bombay, I dug through the stacks at a commercial lending library. I had already exhausted their stock of thrillers (at a rupee per book), then held off book drought for a couple of weeks with science fiction and westerns, and now I found Hemingway at the back of a shelf. I was fourteen, had read precociously some smatterings of what I didn't know then was called "literary fiction" - Conrad, Heller, Tolstoy - but I wouldn't have bothered with Hemingway if not for the charging lion on the cover of the paperback. That, and the decolletage of a distressed damsel and the very large rifle wielded by a hunter promised excitement, so I paid up and went home and read The Short Happy Life of Francis Macomber. Then The Capital of the World. And The Snows of Kilimanjaro. I felt something extraordinary, the dread and clipped despair of the stories, a complete concentration of my own attention, and somehow also a flowing wonder and delight. I'd known this feeling before, during performances of the Ramayana I'd seen as a child perched on my father's shoulders, in moments of high Hindi-movie drama in darkened theatres, but I was now experiencing concentrated waves which I felt in my mind and my body: prickles on my forearms, a tingling at the back of my neck. I knew, even in that moment, that I didn't understand everything the stories were doing, what they were about. I had no idea who this Hemingway was. And yet, here I was at our kitchen table in Bombay, entranced.
Thus began my encounter with American modernists. Through Hemingway, I found Fitzgerald, and Faulkner, and Hurston, and Wharton, and Eliot. After I left my boarding school and joined a college in Bombay, I switched to the "arts stream" and was able to study English Literature, which comprised both British and American traditions. I wrote fiction, seriously and self-consciously, trying to work out what literature was and what it was meant to do. And I knew I wanted to go to America. That was where Gatsby had been written, and somehow that meant I needed to go there to be a writer.
* * * * *
I successfully avoided the question of how I was going to make a living until the summer after I finished my undergraduate degree (with a major in English, a concentration in creative writing, and a novella for an honours thesis). When I was forced to come up with an answer, it was film school: if I couldn't sell screenplays, at least there was a thriving Indian film industry I could get a job in. I applied to the film department at Columbia University, and showed up a few months later on the fifth floor of Dodge Hall driven not so much by clarity about what cinema could offer me, but by a profound uneasiness about what was on offer just a floor below in the writing program: a commitment to a life as a writer of fiction.
So: there I was in 1986, at film school, with the first semester's tuition paid for and two hundred dollars in my bank account. On my second day in New York, I went looking for employment on Columbia's job board and found a listing for "scribes." Of course this was providential, I thought, it was meant to be. I called from the first pay phone I could find, set up an interview, and didn't ask what kind of scrivening they needed. No matter how dead-letterish the situation was, I wasn't going to prefer not to.
The job, it turned out, was not mere copying - the company provided specialised secretarial services for doctors hired by medical insurance companies. We, the scribes, took the handwritten notes from doctors' examinations and typed them up under their letterheads so that they could be submitted as legal statements when insurance claims were taken to court. We deciphered the handwriting, constructed full sentences out of the doctors' telegraphese, inserted a lot of boilerplate text, and sent it off to the respective doctor to review and sign and submit. The work paid well over minimum wage, and I found I could do it in an automated haze which required almost no mental effort.
Three months after I began working, the company acquired its first personal computers for us to work on. I had typed my papers and stories on a terminal attached to the huge mainframe computer at college, and had taken a couple of programming classes, which I thought were tepidly interesting - I was good at writing bubble sorts for lists of words, but it all seemed quite abstract, of no immediate practical purpose. The mainframe was controlled by a specialised cadre of tech-heads, and my access to it was distanced and narrow. Now, though, at my scrivener job, I had a computer I could play with.
I blazed through my assigned work (no more worry about typos and omissions), propped up stacks of paper to signal that I was busy, and dove into the arcane depths of DOS. Here was a complete world, systems and rules I could discover and control. I could write little batch files to run commands to change directories and copy files. And the software we used to write the reports, WordPerfect, I could control that too, write clever macros to put in the date, to recognize my abbreviations for the medical jargon, to pop in whole paragraphs of text. And now any repetition of effort seemed like an insult. Spend half an hour writing a report that didn't quite fit the standard format? No way. Screw that. I'd rather spend six hours tinkering with if-then-else routines in my report macro so it would support this specialised format too.
Soon I was the de facto tech-support guy for our little office, and was advising on future purchases of hardware and software. I bought computer magazines on the way home, and lusted after the monster PCs in the double-page photo spreads: more speed, bigger memory, huge hard disks. I wanted all these, but even on the decidedly low-end machines I had access to, there was an entire universe to explore. There were mysteries, things I didn't understand, but there were always answers. If I tried hard, there was always a logic to discover, an internal order and consistency that was beautiful. And I could produce these harmonies, test them, see them work. When a program broke, when it did something unexpected, I could step through the code, watch the variables change, discover where I had made unwarranted assumptions, where the user did something I didn't expect, and then I could change, adapt, and then run the code again. And when I made it work, the victory thrilled through my brain and body. I wanted to do it again. And again.
MIRRORED MIND: MY LIFE IN LETTERS AND CODE
Author: Vikram Chandra
Publisher: Hamish Hamilton
Pages: 272
Price: Rs 499
Excerpted with permission from Penguin Books India