Alec Nevala-Lee

Thoughts on art, creativity, and the writing life.

Posts Tagged ‘Shawn McGrath

A writer’s code

with 3 comments

Anagram generator from Foucault's Pendulum

One of the small pleasures in writing this blog—and in particular in coming up with the quotes of the day—has been a renewed appreciation of the affinities between writing fiction and computer programming. There’s a remarkably rich body of literature on the art of coding, and simply by browsing through the available works in search of memorable insights, I’ve come to realize that coders deal with many of the same problems that I’ve had to confront in my novels, especially structure, clarity, and managing complexity. Hacking, like writing, requires a balance between formal elegance and quick and dirty fixes, and a coder is often required to choose between ingenuity and readability: a clever solution may be beautiful in the moment, but it can be all but impenetrable if the author—or anyone else—comes back to pick it apart months or years later. And unlike novelists, coders get immediate feedback on the validity of their solutions from a rigorous, if somewhat unimaginative, reader.

The problem is that I haven’t done a lot of hacking on my own. Growing up, I spent hours messing with BASIC on an ancient “portable” computer that didn’t even have a hard drive. (My earliest program, written when I was thirteen or so, involved expanding the anagram generator that Umberto Eco provides in Foucault’s Pendulum to handle words of more than four characters.) Later, I took a computer science class or two in high school, but I haven’t done anything meaningful since.  More recently, I’ve found myself longing to jump back into programming for a fairly specific reason: not to do any serious coding of my own, and certainly not to get paid for it, but simply to gain access to the enormous amount of material written by coders on how they approach their work. Compared to the handful of well-worn tidbits that writers repeatedly invoke on craft, it strikes me as admirably pragmatic, dense, and varied, and even at a glance, it clearly has elements that I can put into practice.

A snippet of source code from Doom 3

This leaves me with the question of which language to learn, an issue that inspires predictably strong opinions on all sides. Not surprisingly, I made the final call based on the books I wanted to read. At the moment, I’m working through The C Programming Language by Dennis Ritchie and Brian Kernighan, which is generally regard as the best book of its kind, and I’m planning to follow it up with The Design and Evolution of C++ by Bjarne Stroustrup, which is one of those extended looks into a sustained design process that I find so irresistible, whether the subject is writing, animation, or cuisine. C and C++ might seem like odd choices for recreational coding, but they’re useful for my purposes because there’s so much source code available, along with what I can only describe as a highly specialized form of literary criticism, like Shawn McGrath’s recent appreciation of the beauty of Doom 3. There’s a whole world of material out there, and I’ve found that it only takes a little work to start to appreciate the basics.

Once I’ve played with C and C++ to my satisfaction, I’m hoping to jump into Lisp. This might seem like another strange choice, and I hope to explore it further in a future post. Suffice to say that Lisp, like C, offers a range of interesting reading material, from Paul Graham’s books on the subject to Douglas Hofstadter’s three essays in Metamagical Themas to Peter Seibel’s Practical Common Lisp. (Seibel, a former English major, is also the author of Coders at Work, which attempts to do for hacking what the Paris Review interviews did for fiction.) Lisp also strikes me as the most novelistic programming language, and the one with the greatest natural affinities to creative writing—but we’ll see. When you’re a writer, you’re always looking for tricks that your peers haven’t discovered yet, as well as any source of insight or competitive advantage, and given my interests and approach to craft, I think a deep dive into coding is the next logical step. Whether or not it yields anything useful is something I’m still waiting to find out. But if it does, you’ll be reading about it here.

The seductions of structure

leave a comment »

Structure of an essay by John McPhee

Learning about a writer’s outlining methods may not be as interesting as reading about his or her sex life, but it exercises a peculiar fascination of its own—at least for other writers. Everyone else probably feels a little like I did while reading Shawn McGrath’s recent appreciation of the beautiful source code behind Doom 3: I understood what he was getting at, but the article itself read like a dispatch from a parallel universe of lexical analyzers and rigid parameters. Still, the rules of good structure are surprisingly constant across disciplines. You don’t want more parts than you need; the parts you do have should be arranged in a logical form; and endless tinkering is usually required before the result has the necessary balance and beauty. And for the most part, the underlying work ought to remain invisible. The structure of a good piece of fiction is something like the structure of a comfortable chair. You don’t necessarily want to think about it while you’re in it, but if the structure has been properly conceived, your brain, or your rear end, will thank you.

In recent weeks, I’ve been lucky enough to read two enjoyable pieces of structure porn. The first is John McPhee’s New Yorker essay on the structure of narrative nonfiction; the second is Aaron Hamburger’s piece in the New York Times on outlining in reverse. McPhee’s article goes into his methods in great, sometimes laborious detail, and there’s something delightful in hearing him sing the praises of his outlining and text editing software. His tools may be computerized, but they only allow him to streamline what he’d always done with a typewriter and scissors:

After reading and rereading the typed notes and then developing the structure and then coding the notes accordingly in the margins and then photocopying the whole of it, I would go at the copied set with the scissors, cutting each sheet into slivers of varying size…One after another, in the course of writing, I would spill out the sets of slivers, arrange them ladderlike on a card table, and refer to them as I manipulated the Underwood.

Regular readers will know that this is the kind of thing I love. Accounts of how a book is written tend to dwell on personal gossip or poetic inspiration, and while such stories can be inspiring or encouraging, as a working writer, I’d much rather hear more about those slivers of paper.

Scene cards on the author's desk

And the reason I love them so much is that they get close to the heart of writing as a profession, which has surprising affinities with more technical or mechanical trades. Writing a novel, in particular, hinges partially on a few eureka moments, but it also presents daunting organizational and logistical challenges. A huge amount of material needs to be kept under control, and a writer’s brain just isn’t large or flexible enough to handle it all at once. Every author develops his or her own strategies for corralling ideas, and for most of us, it boils down to taking good notes, which I’ve compared elsewhere to messages that I’ve left, a la Memento, for my future self to rediscover. By putting our thoughts on paper—or, like McPhee does, in a computerized database—we make them easier to sort and retrieve. It looks like little more than bookkeeping, but it liberates us. McPhee says it better than I ever could: “If this sounds mechanical, the effect was absolutely the reverse…The procedure eliminated all distraction and concentrated only the material I had to deal with in a given day or week. It painted me into a corner, yes, but in doing so it freed me to write.”

This kind of organization can also take place closer to the end of the project, as Hamburger notes in his Times piece. Hamburger says that he dislikes using outlines to plan a writing project, and prefers to work more organically, but also observes that it can be useful to view the resulting material with a more objective, even mathematical eye. What he describes is similar to what I’ve called writing by numbers: you break the story down to individual scenes, count the pages or paragraphs, and see how each piece fits in with the shape of the story as a whole. Such an analysis often reveals hidden weaknesses or asymmetries, and the solution can often be as simple as the ten percent rule:

In [some] stories, I found that most of the scenes were roughly equal in length, and so cutting became as easy as an across-the-board budget cut. I dared myself to try to cut ten percent from each scene, and then assessed what was left. Happily, I didn’t always achieve my goal—because let’s face it, writing is not math and never should be. Yet what I learned about my story along the way proved invaluable.

I agree with this wholeheartedly, with one caveat: I believe that writing often is math, although not exclusively, and only as a necessary prop for emotion and intuition. Getting good ideas, as every writer knows, is the easy part. It’s the structure that makes them dance.

Written by nevalalee

January 28, 2013 at 9:50 am

%d bloggers like this: