Skip to content


The coders approach to writing fiction

As a programmer I have a slightly different view of the world as someone who has a deep literary background. My technical experience has been with a lot of the ins and outs of organization of raw hard data and text. Now that doesn’t make me a better writer (or a good one at all) but it gives me certain interesting perspectives to writing.

First is the structure of your novel. One of the heralded ways to do it, is a reverse minify approach, where you write the most condensed form of your novel, in one to three sentences down, then you expand that to about double it’s size and keep expanding until you have a novel. That works fine if you have that kind of idea and then ideas sprout from that stem, but in my experience and in my discussions with other writers, that’s pretty much never the case.

Instead the writing starts somewhere in the middle, the end or on multiple points together. A general Idea has formed of the story, but often there are a lot of black holes in it, like an end, a definitive start or how to get from one of the blooming ideas to another. So the writer tells the story about the hero behind enemy lines, and also writes down how the hero has been flirting with a maiden in his hometown, that’s on the other side of the fronts. Now how to get from point A to point B is often unclear.

Each of these fragments can be written on their own, and often I have seen multiple of such threads grow rather large and impressive, but they still didn’t touch. But with time, most writers find a way to weave them together and create one big story. Of course story cohesion is a big problem then, but it’s also not at the same time in some way. For example could the writer work on two threads, both about the same place, or the same people, and in one thread they talk about events that happened before and then the writer goes and writes those events, so cohesion is given.

Now to handle all that, some structures are needed and some tools, which are all freely available.

As first step, the usual suspects like Word and consorts have to step back. Instead a simple text editor, that still has some comfort functions like Notepad++ steps into it’s place. With it you simply create TXT files, no special formating other than new paragraphs and so on, just plain old text files. Notepad++ allows you to enlarge the font if that works better for your typing and also change the font for display purposes. You’ll get the general feeling of your Word back, but you have the all important smallness and format of a text file.

For each chapter, you create a new file. Out of experience and to make life easier, I suggest naming them “Chapter 001.txt” and so on. That way you can create 1000 chapters if you must and the format of the files stay the same, which also sorts them the way you expect under any operating system. In Notepad++ you can have multiple files open at the same time each in it’s own tab, so switching fast for reference is easy.

Also create files for lore items, one for each item. For example a city, a person, a special item, a monster, whatever comes to mind. I adopted the wiki approach and just use the name, but you could use a prefix like “City ABC.txt” or “Person XYZ.txt” if that is more convenient for you. Nobody might ever see those, but you have a point of reference when you want to find a small piece of information without having to dig through your chapters. It’s something that helps with cohesion again. Most programmers have such files laying around where they paste pieces of code, write small notes and other explanation of things they want to keep together with a particular project.

And create X-chapter files, for your threads. We already had chapters, well that would be for the real chapters, that have found a place in your story. Now these ones are for the multiple threads you might weave in your story. My own naming scheme looks like this: “Chapter X001-001.txt” for the first part of the first thread and “Chapter X001-002.txt” for the second part and so on. If I start a new thread it begins with X002-001 again. That way within a thread I have an order and can just move them around where I want them.

Also do not add the chapter number inside the files. If you later rename them that will all change. If they have titles, put in titles, but leave the numbers out until you are sure you have found the correct spot for your chapter. You might even at a later date change the order of your real chapters, so keep the numbers away from inside the files as long as possible. I saw an author adding small chapters between every second or third chapter and so he had to go renumber everything after ward. Save the time and hassle and do it as one of the last things, if ever.

So, now you have all these txt files, what now? You have sacrificed the handiness of the word processing application for this?

It has great benefits. One of the major one is that you can concentrate on actual writing. If you don’t disable these automatic gadgets, your application will otherwise constantly remind you about typos, grammatical mistakes or names you made up and it can’t cope with. Instead of this constant nagging, you just write. Once done, copy paste it into a blank word processing document, run a checker over it, and clean it up in one swift go. Then copy paste it back into your text editor and you have the same benefit, just more efficient. You got to write easier yet the end result is just as clean.

The biggest though comes now and is called Concurrent Versions System, or CVS. Now you don’t really need to know the gritty details. The easiest way to tell you what it is and what it can do for your writing is to show you.

I’m using Subversion, something that works great under Windows but is also available for most other operating systems. TortoiseSVN is in my humble opinion the best windows client, that also directly integrates into the shell. After installing and a reboot it’s available. Let’s assume your book project is in “C:\Book”. So go into that folder and create two new ones, “SVN” and “Content”. Now into content, you put all your text files. You could make sub folders there too, but it’s usually easier for this type of thing if you don’t. Now right click on SVN and move over the new TortoiseSVN entry and select Create repository here, from the menu. After a couple seconds, it’s done.

Now you need to make a checkout, to create the basic structure to use subversion, or short SVN, correctly. Right click on the content folder and choose check out this time. In the upper area, give it the path to the svn repository you created so in this example it should be “C:\Book\SVN”. Leave the rest as is and let it run. It will ask you, if you copied content already if it should run the checkout although there are files, just say yes, as the repository is empty, and it will create the structure. You will notice a small icon on the folder now. There are a few, but the important ones are green check mark and red exclamation mark. The green check means all is in sync with the repository, the red one means you have changes that have not been put into the repository.

Right click the content folder and chose “SVN Commit”. This you will use now in the future a lot. With this you put new changes into the repository. Make sure all files are selected on the bottom of the dialog, new files are by default not selected. You can add a comment above if you like, for late back tracking, and then hit ok.

Now you have committed a first revision. Now every time you get away from your computer for a few minutes or longer, save all files, and commit a new revision. These revisions are stored as changes only, so it will not grow extremely fast and gobble up your hard disk. Besides since you only work with txt files, that wont happen either way.

Every revision you make, is a snapshot of that very moment, over all the files in the content folder. They need to be txt files for this to work properly, as it can’t do the same for word files or images. You can at any given moment, jump to any given revision you like and compare them with each other, or revert a file entirely to that moment. So you have done the main writing for the day, you make a revision. Then you go and throw it into the word processor to spell check, save it again and make a new revision. You want to redo a part, you make a new revision then rewrite it and make a new revision. Now you think that new part sucks and your old one was better, you just revert back to that other version.

It also keeps track for you how well you progressed and you can, with timestamps of each commit, check how much you did on each day. That is not a standard function, but you can find tools for that easy.

You can even delete files form your content folder, or how SVN calls it, your working copy, and revive them later on with SVN again. You just need to use the SVN delete command for it to be gone from the folder for certain.

I have made very good experiences with these things and would love to hear from others who tried this method. It’s all free, you can even use OpenOffice for wordprocessing and not one of the applications has cost you a cent.

Posted in Writing.