Alec Nevala-Lee

Thoughts on art, creativity, and the writing life.

Posts Tagged ‘The C Programming Language

How is writing like software development?

with 2 comments

Bjarne Stroustrup

  • The most important single aspect of software development is to be clear about what you are trying to build.
  • Successful software development is a long-term activity.
  • The systems we construct tend to be at the limit of the complexity that we and our tools can handle.
  • There are no “cookbook” methods that can replace intelligence, experience, and good taste in design and programming.
  • Experimentation is essential for all nontrivial software development.
  • Design and programming are iterative activities.
  • The different phases of a software project, such as design, programming, and testing, cannot be strictly separated.
  • Programming and design cannot be considered without also considering the management of these activities.

Bjarne Stroustrup, The C++ Programming Language

Written by nevalalee

August 31, 2013 at 9:50 am

The recursive art of fiction

with 3 comments


One of the most striking things about writing fiction is how the strategies you apply to the highest level of story often work on the smallest pieces as well. Take, for instance, one of the most basic rules of craft: start the story as late in the action as possible, and end it as soon after the climax as you can. In the rewrite, jumping in late and getting out early sometimes means cutting pages from the beginning and end to remove extraneous material, or engaging in slightly more sophisticated surgery: the pulp novelist Jack Woodford, in two brilliant pieces of advice I’ve quoted here before, notes that you can keep much of the “the usual driveling collection” of exposition and anticlimaxes if you restructure the novel so that the real beginning and end come before and after the boring parts. The same rule applies to individual chapters, scenes, and beats. William Goldman famously advises writers to omit the beginning and end of each scene so the story jumps from middle to middle, and I’ve often fixed a sequence of chapters that didn’t work by cutting the first and last paragraphs of each.

In other words, a rule that works for the overall shape of the story also helps you make decisions about the structure of its smallest components. This isn’t so far from the principle of recursion as understood in computer science. Recursion means writing a function—a set of instructions—that at one point in the process calls on itself to deal with a subset of the larger problem. The most famous example is Quicksort, the sorting algorithm developed in the sixties by C.A.R. Hoare. Quicksort begins with a string of numbers to be sorted, picks one number at random from the middle of the string, then sorts the entire list into two parts, with all the larger numbers in one half and the smaller ones in the other. Then it applies itself to each smaller piece, dividing and sorting until a subset has fewer than two elements, which means we’re done. And although recursion doesn’t always result in saving time or storage, it’s a useful way to think about problems, as Kernighan and Ritchie note: “Recursive code is more compact, and often much easier to write and understand, than the non-recursive equivalent.”

Quicksort tree

That’s the benefit of a recursive approach to fiction, too: it tackles big problems in ways that are intuitively easier to understand because you’ve already used them on a lower level, and vice-versa. I’ve found that when a novel gets off track, it’s often because the writer has gotten lost in the weeds: you get hung up on little details—like how to get a character out of a room—until you’re so close to the problem that you can no longer see it. The solution is to remember that each chapter, scene, or paragraph is really a story in miniature, and it can be hacked in the same way you found the novel’s three acts. A recursive set of rules for writing fiction might look something like this, starting at the level of the story as a whole and working your way down:

  1. Divide the narrative unit into three parts. (This is usually a matter of intuition, and, like choosing the initial element in Quicksort, it doesn’t really matter at first where you draw the lines. We divide the story into three parts, rather than two, in deference to the rule of three.)
  2. For each unit, figure out the protagonist’s objective and the action he or she needs to take to achieve it.
  3. Repeat for each subsidiary unit until it can’t be divided any further.

In practice, this means that the story as a whole falls into three acts; each act falls into three sequences, with each one consisting of, say, ten chapters; each sequence yields three smaller sequences; each chapter has its own beginning, middle, and end; and so on down to the level of the page and paragraph, until you’re down to a single beat—a unit of narrative that can’t be divided any more. For that beat, you find the protagonist’s objective and concrete, physical actions, which, when taken together, add up to the overall objective for the scene, all the way up to the superobjective for the novel as a whole. (This way of breaking down scenes into beats and thinking in terms of objectives is more fully explored in David Mamet’s On Directing Film, which does for storytelling what The C Programming Language does for coding.) Put this way, it may sound mechanical, and it is: in practice, it’s more of a dialogue between the writer’s intuition and rational mind, as you try to fit in scenes that have seized your imagination into the overall logic of the narrative. Like coding, it’s rarely as neat in practice as in theory. But thinking about it recursively helps us remember that the rules at the top are often the same as the ones at the bottom.

Written by nevalalee

August 19, 2013 at 9:31 am

%d bloggers like this: