Computer programming & writing fiction: Iterative processes

Repetition (elPadawan, CC BY-SA 2.0)

Repetition (elPadawan, CC BY-SA 2.0)

Previously I’ve noted the similarities between computer programming and writing fiction, saying both attracted their own practitioners. I then explained why I view computer programming, as well as computer programs, as forms of art.

How else is writing fiction like computer programming? Practicing the two, one common aspect I’ve gleaned is their repetitive natures. Both are iterative processes.

I cannot in good faith declare any fiction I’ve written “done” until I’ve read the final draft from start to finish eight or more times. (Usually the number is higher.) With each read, sentences are moved or removed, paragraphs rearranged, punctuation revised, word choices are evaluated, and so on. Shaping prose is one of the most important skills a writer can cultivate. (Journalists do this in their sleep. Minutes after the final out, San Francisco Chronicle baseball writer Susan Slusser files a game summary that is polished, informative, and to the point.)

In fiction, editing is usually described as fine-tuning a manuscript, but more often it’s about being bold—knowing when to strike a paragraph, a page, or even a chapter, all in the service of a better story.

As any computer programmer can tell you, this is a familiar process. Programmers probably spend more time at the keyboard revising existing code than writing new code. Small program edits—similar to line edits or word choice—are common enough, but when more major surgery is performed, programmers will often use a special word: refactoring. Refactoring is restructuring existing code without changing its external behavior. (It’s usually done to make the code easier to read and maintain, not to add a new feature or fix a bug.)

That’s the crux: Without changing existing behavior. It’s funny, in writing fiction, if you make a lot of bold changes, it’s considered a success if the story seems “new” or “better” to a reader. In writing code, success is if you make a bold refactoring and the program operates exactly as it worked before.

The Ouroboros

I enjoy reading how other authors developed their fiction. Authors selected for Best American Short Stories (and other volumes in the Best American series) are given the opportunity to write a capsule for the books’ back matter. They often discuss inspiration for the story, and how external factors shaped its outcome. Writers’ correspondence is another goldmine for learning creative processes. (In particular I recommend Raymond Chandler’s Selected Letters, which is a master class in writing, style, and technique.)

Often when an author discusses how they developed a story, I’ve noted they can’t pin down the exact moment of inspiration. There might be some flash where the creative process launches, but so many times writers confess how stories come from a nagging itch to write on a subject or develop some character trait. Long-forgotten inspiration will come roaring back to life for some reason. Writers some times talk about stories as though they “demanded” to be written.

Programmers have similar stories, although the inspiration may not be as abstract as, say, a line of dialogue or a character detail. Usually it’s a need driving the creation of new software, needs like “I wish there was a web site for me to connect to all my friends” (social networking) or “I wish I had a typewriter where it was easy to correct mistakes, and it would even check my spelling for me” (word processor).

Many times I’ve read of authors returning to old work and fighting (or succumbing to) the urge to edit it. The edits may only be a comma here, a semicolon there. They may be larger edits , striking paragraphs or scenes in the pursuit of a tighter tale. Programmers deal with this urge too, always looking to tighten up code and make it more efficient or elegant.

I’ve quoted this elsewhere, but it’s worth repeating:

…software development is an iterative and incremental process. Each stage of the process is revisited repeatedly during the development, and each visit refines the end product of that stage. In general, the process has no beginning and no end. [Italics mine.]

That was written by Bjarne Stroustrup, the inventor of the C++ programming language. Everything in this quote pertains to writing fiction as much as it pertains to writing code.

When I edit stories, I visit and revisit the story as part of the editing process, to smooth and refine the language, to ensure the story flows smoothly. Programming has a similar process, a continual revisiting and revision of the code to remove flab and tighten up its execution.

That’s what Stroustrup meant when he said the process has no beginning and no end. Stories and computer programs are never finished. They can always be made a bit better.

Sometimes alteration worsens the final product. When coding, I often talk serious changes as “surgery.” While it might be necessary, it’s possible to hurt the program while improving it. Touching code in one place can break code in another place. This is why sometimes you’ll download an update to an app and it seems slower or simply broken, even though the developer swears they’ve made improvements.

Likewise, fussing over a novel or a story can hurt it too. In the original editions of The Martian Chronicles, the chapters were dated like a diary, starting from 1999 and ending in 2026. Today, revised editions use dates from 2030 to 2057. A small change, undoubtedly made to preserve the story being told “in the future,” but it stole away some of the book’s charm. In my youth, 1999 was a magical date, a momentous odometer signaling a shift to the bold 21st century. 2030 is just another number.

A common adage among software developers is “Don’t fix what’s not broken.” The same can be said for fiction.


Paul Joseph. (CC BY 2.0)

Paul Joseph. (CC BY 2.0)

Programmer Ben Sandovsky observes:

Treat yourself [the programmer] as a writer and approach each commit as a chapter in a book. Writers don’t publish first drafts. Michael Crichton said, “Great books aren’t written– they’re rewritten.”

Sandovsky is exhorting computer programmers not to make hasty changes to a computer program, but to edit and revise those changes before officially adding them to the program.

Late in the editing process, I’ll often read my stories aloud to make sure they flow well. I’ve never read my code aloud—computer languages aren’t like human languages, for the most part—but I’ve certainly eyeballed my code closely, going over it line-by-line, before committing it.

I often use the word distill for both pursuits—to purify, condense, and strengthen through repetitive processes. Writers and coders don’t simply edit their work, they distill it down to its essence.

Lazy writing makes for boring reading. Lazy programming makes for buggy software. In general the process has no beginning and no end. The art is knowing when to let go and release your hard work to the world.

Writing better fiction with Syd Field’s three-act screenplay structure: The paradigm

Syd Field

Syd Field

(See my “Continuing Series” page for a listing of all posts about using Syd Field’s paradigm to write fiction.)

As mentioned in my first post of this series, Syd Field calls his structure “the paradigm”:

The paradigm is a dramatic structure. It is a tool, a guide, a map through the screenwriting process. As defined in Screenplay, a paradigm is a “model, an example, a conceptual scheme.” … A screenplay is an open system.

That last bit is important. A screenplay—and a novel, and a short story—is an open system. Compare this to an observation made by Bjarne Stroustrup, creator of the C++ programming language:

…software development is an iterative and incremental process. Each stage of the process is revisited repeatedly during the development, and each visit refines the end product of that stage. In general, the process has no beginning and no end.

(Emphasis mine.) Although Stroustrup is describing how software is written, I believe his observation applies to writing fiction too, and most creative endeavors.

Think of a story you’re working on right now. Do you really know where your inspiration for it started? Can you enumerate every influence leading up to it? Now think of your last completed story. Are you really finished with it? I’ve discovered recurring themes in my own work that make me wonder if I’m still “writing” older work.

Writing is an iterative and incremental process of inspiration, evaluation, and revision. Each iteration shapes and smooths and revises. Nothing in a story is sacred. Everything in it deserves questioning and challenging.


Field’s paradigm asks you to think of a story as three interconnected acts. Each act is unit of drama. It may be a scene or a series of scenes, but in fiction, those scenes are not necessarily “in the moment” of the narration. (For example, Heart of Darkness is entirely narrated by Marlow in England, but the acts of the story are the events along the river in Africa.)

The three acts are not vacuum-sealed. Events in Act One have ramifications that carry into Act Two and even Act Three. Questions posed on the first page may not be answered until the last.

At its simplest, the three-act structure goes back to Aristotle’s Poetics:

Tragedy is an imitation of an action that is a whole and complete in itself…a thing is a whole if it has a beginning, a middle, and an end.

In some ways, that’s all the three acts are: the beginning, middle, and end of your story.

Each act is not the same length. Remember, in movies and theater, time is everything. (In both genres, one manuscript page is considered to be approximately one minute of stage or projection time.) Most films are 90 to 120 minutes long. Theater tends to run closer to three hours, but there’s been a recent trend for ten-minute plays.

As far as page count, fiction is all over the map. What’s more, fiction writers don’t tend to obsess over how long it takes for a reader to read the story. For my interpretation of Field’s paradigm and applying it to fiction, I don’t worry about the length of each act in terms of page count. What’s important is their proportions:

  • Act 1: 25%
  • Act 2: 50%
  • Act 2: 25%

So the middle section of the story is roughly twice as long as the opening and concluding acts—roughly.

If you think about it, that’s not terribly revolutionary news to a fiction writer. We’re taught to watch out for long openings. Exposition, introduction, summary, prologue, and/or excess scene-setting merely serve to delay the start of the narrative. Likewise, we’re told to watch out for ending exposition, long-winded conclusions, and so forth. We’re supposed to be eagle-eyed for when the story “really” starts (in medias res is the phrase usually mentioned here) and when the story “really” ends (think of Gordon Lish cutting the final pages of a Raymond Carver story).

In a nutshell, that’s what Syd Field encapsulates with his observation about act lengths. Trim the opening down, wrap up the ending as concisely as possible, and save the meat of the story for the middle. I would push harder on those numbers—20% / 60% / 20%—but there’s more to Act One and Act Three than the introduction and conclusion of a story. (More on that later.)

Three—no, four—acts

One problem with Field’s original three-act structure in Screenplay was the long haul from the end of Act One to the start of Act Three. Act Two is fifty percent of the story, 60 pages of screenplay manuscript. Since Field’s paradigm was intended to act as a guide or a map, how could he advise how to write a screenplay when half of his map was blank white nothing?

In his later Screenwriter’s Workbook, Field explains a discovery he made after Screenplay‘s publication. In many movies he found there’s a midpoint event that cleaves the second act into two smaller units of drama. This gives the screenwriter a target to shoot for when starting Act Two:

Knowing the midpoint is a tool; with it you have a way of focusing your story line into a specific line of action. You have a direction, a line of development.

(Playwriting defines “action” as a character’s desires and motivations, not shooting guns and car chases. Although Field doesn’t define the word, I believe he uses “action” to mean the results of a character attempting to fulfill those wants—in other words, we see the character trying to get what they want and experiencing the consequences. Aristotle said story “is not an imitation of men but of actions and life.” His use of the term could apply to both definitions.)

Between reading Field’s description of the midpoint, thinking of some examples in film and fiction, and my own experience, I see the midpoint as a Janus point in the story, a moment of looking backward and forward. Even if the storyline has wandered a bit (due to character development or a digression—any reason, really), the midpoint is a stitch connecting the beginning to the end.

With his discovery of the midpoint, Field’s three-act structure looks more like a four-act structure, but the basics are the same. I’ve labeled them with Field’s names, adding my own label for 2A:

  • Act 1: Setup (25%)
  • Act 2A: Complication (25%)
  • Act 2B: Confrontation (25%)
  • Act 3: Resolution (25%)

The labels are to offer the thrust of each act’s purpose. There’s no requirement that every sentence in Setup be setting up your story, or that every scene in Confrontation be confrontational. It’s just a general idea of the direction of that act.

The percentages may look daunting or restrictive, but understand that they’re to indicate rough proportions and not page counts. If your novel’s Act One is only ten percent of the pages, that may be just fine, or even great. But if your Act One is fifty percent of the pages, Field’s paradigm suggests you need to rethink your Setup. I suspect your readers would too.

Part three: the treatment