Alec Nevala-Lee

Thoughts on art, creativity, and the writing life.

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.

3 Responses

Subscribe to comments with RSS.

  1. All Things Considered tonight did a piece on the big eastern seaboard blackout from a couple years ago and one of the interviewees was Dr. Frank Merat, professor of computer science at Case Western Reserve University, whose intro to programming CMPS 131 (it was referred to by everyone as “Chomps”) course was my first exposure to C++ and programming. And that’s how this comment relates to your post.

    wakes

    August 13, 2013 at 7:51 pm

  2. Professor of electrical engineering and computer science. EE was his connection to the blackout story.

    wakes

    August 13, 2013 at 7:53 pm

  3. Cool. Incidentally, if you still have any books on C++ or programming in general, I’d love to borrow them sometime.

    nevalalee

    August 13, 2013 at 8:07 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: