In my first entry on this blog I mentioned the Gigamonkey Four-Step Algorithm for Writing a Book. In the past week, I’ve twice had occasion to explain this algorithm to someone. Rather than wait for a third occasion, I figured I’d write it down. Here it is.
Write the index. Write down, in no particular order, every word, phrase, name, and concept that you would expect to appear in a well-prepared index of your book, assuming the darn thing was already written.
Write a hierarchical outline. This outline should contain, somewhere, all the items from your index. Follow the rule from junior-high essay writing that you can only create a sub-topic under a topic if it will have at least one sibling. But don’t worry if your outline gets ridiculously deeply nested. If you’re a forest-then-trees kind of person you can build your outline top down — define the top-level topics you want to talk about, then split those topics into sub-topics and those sub-topics into sub-sub-topics, and so on until you get down to a granularity where you can start inserting items from the index. Or you can work bottom-up — start directly from your index, lumping related items together, then lumping the lumps into bigger lumps. I found that alternating between top-down and bottom-up worked best for me.
Write a a flattened outline. Books are a linear medium. While it can be immensely useful to organize your thoughts hierarchically, you are ultimately going to have to guide your reader from A to Z along some linear path. In his essay The Cognitive Style of PowerPoint Edward Tufte observes:
People have communicated about complex matters for centuries without hierarchical bullet lists. Richard Feynman wrote about much of physics — mechanics, optics, thermodynamics, quantum behavior — in a 600-page book with only 2 levels: chapters and headings within chapters. (Emphasis in original.)
Following Feynman’s lead, in this step you should produce on outline with no more than three-levels: chapters, sections, and paragraphs. Each paragraph-level outline item should be — again shades of junior high — a topic sentence for that paragraph. This will let you judge whether it’s actually going to be possible to move from paragraph to paragraph in a reasonable way — can you imagine a transition that’s going to get you from the topic of one paragraph to the topic of the next?
Note that there’s more to this step than simply flattening the outline from step two. The step two outline is a taxonomy of all the things you want to talk about, but it’s unlikely your readers are ready to digest a whole taxonomy in one go. You’ll likely find that in order to provide a comprehensible linear order for your reader, you’ll need to split certain taxonomic topics across different chapters or sections. For example, when writing Practical Common Lisp, my hierarchical outline contained top-level sections on functions, variables, and macros, three of the main elements of Common Lisp. Initially I thought each of these top-level categories would map to a chapter. However, it turned out it was impossible to write about all aspects of functions without at least some discussion of variables. Yet, there were also aspects of variables that could only be meaningfully discussed after discussing functions. And macros were similarly intertwined with the other two topics. Eventually I figured out that what I needed to do was to write a chapter in which I would discuss the basics — but just the basics — of functions, variables, and macros before moving onto dedicated chapters for each topic. It also turned out that it was useful to split my discussion of macros into two chapters. Thus the three top-level topics from my hierarchical outline had to be split: part of each became a section of chapter four and the remainder became the root of their own chapters except for the macros section which was split into two chapters. In other words, this is the step where you think about the structure of your book, whether you can march straight from A to Z or whether you need to occasionally circle back to clarify things that you couldn’t give full justice to the first time you mentioned them.
Write the book. In theory, all that remains is to work through your step three outline, fleshing out each paragraph-level topic sentence with the full paragraph and providing a transition to the next paragraph. In practice, you’ll probably have to frequently pop back to step three if not all the way back to steps one and two. During the actual writing of Practical Common Lisp, I was constantly discovering things that, had I explained them already, would make whatever paragraph, section, or chapter I was currently working on completely straight-forward to write. But then I’d have to figure out how to work those things in somewhere earlier. And often when I actually tried to write those earlier sections, I’d discover some other concepts that I’d really need to introduce before I could write them. I’d know I was having a particularly bad day when I’d discover that I’d looped — that the thing I needed to discuss first, in order to be able to explain everything else I had pushed on the stack, was the very thing I had started with before pushing all these other things on the stack. At that point I’d have to go back to step three and re-outline the relevant sections in light of my new understanding of how things actually fit together. Maybe I could have avoided some of those bad days by better up-front outlining but I suspect not; it was only by actually getting down to the nitty gritty of writing paragraphs and wrestling with how to explain each thing that I could discover the flaws in my more general plan of attack. It was painful at times but I don’t think there was any way to avoid it.
Step four is also obviously the step when you deal with crafting your deathless prose. I don’t have a lot to say about that as good prose style seems more a matter for heuristics than algorithms. That said, if you’ve actually organized your material into some rational, linear order, and you can manage to say what you mean at the sentence and paragraph level, you’ll be doing a lot better than a lot of authors. I did find it useful to print my chapters on actual paper in a reasonable-size font with nice wide margins and double spacing between the lines and to sit down to edit them, away from the computer, with a red pen in hand.
But what do I know? I’ve only written one book. Check back in a few years when I’ve finished my next book and I’ll probably have a whole new algorithm. But for now, as far as I know, that’s how to write a book.