This month I published the second volume of A Programmer’s Guide to Computer Science. One thing I’ve been asked is: why write books?

Four or five years ago, I was looking for a side project and I asked myself, what makes me unique? What can I do that doesn’t have a million other people trying to do the same thing? A number of items in my background pointed to writing a book as a likely option:

  • I used to write regularly for Scrye magazine, so I already know that I can write nonfiction.
  • My last full time job before becoming a programmer was as a math textbook editor.
  • I work as a senior software developer and have managed projects involving multiple programmers.
  • I have a PhD in computer science.
  • I enjoy teaching, but I was often unhappy with the available textbook options for the classes I taught.
  • I’ve previously published short ebooks (most notably, Healthcare in the 21st Century), so I have experience navigating Amazon’s system.
  • I’ve spoken at several conferences on computer science topics (sorting algorithms, graph theory) and seen that there are a number of programmers interested in learning these topics.

So writing a computer science textbook seemed like a good way to utilize my background and do some teaching (I do miss teaching), while also being completely separate from my day job (meaning there’s zero chance I run afoul of the non-compete clause in my contract).

I’ve advised a few people on the book writing and publishing process lately, so I thought I’d put some of that down in my blog. I want to call out that this post is not going to cover marketing your book, which is an entirely different subject altogether. You can write the best book in the world, but unless you can find a way to get it in front of people, nobody is going to purchase it.

Also, the steps below are for books that I self-published. I’ve considered traditional publishing, but chose to self-publish my books for three reasons:

  1. I keep more control over the process.
  2. I keep more of the earnings.
  3. Turnaround is faster; once the book is written and edited, it’s available for sale almost immediately.

That said, volume 1 has been translated into Russian by a traditional publisher and I may choose to work with one in the future if I have a book that I feel would be appropriate for them.

Write

I will assume that you already know how to write, and have a topic in mind that you want to write about. You can use any writing software you like, but be aware that you may need to convert it to an acceptable format.

I wrote the Programmer’s Guide books in LaTeX, for several reasons:

  • I can use tikzpicture to generate graphs.
  • I really hate trying to typeset formulas in Word.
  • I really like how the finished product looks.

That said, creating the ebooks afterwards was a major pain. I can compile directly to PDF for the print book, but getting the content into something that could be used for a reflowable ebook was difficult. (A reflowable ebook is one where the page can be resized and the content will be rearranged appropriately, so the same book will look fine on a paperback-sized ereader or a full-sized tablet. PDF is an image format and is very much not reflowable). There are plugins to compile .tex files to html or import into Word, but I found that they did not work well with the complex documents I was creating. For volume 1 I created the html file, then manually fixed everything that didn’t get set up correctly before using Amazon’s software to create the .mobi file. For volume 2, I used Adobe Acrobat to create a Word file from the PDF, then loaded that Word file into Vellum and used it to create the ebook. In both cases, a lot of cleanup was required. (The second method did result in a nicer book, and I’ll be redoing the volume 1 ebook when I get a chance).

For future books that don’t depend on creating graphs and formulas, I’ll probably just use Scrivener or Word and avoid the whole problem. (Added bonus: spellcheck! I don’t have spellcheck functionality in LaTeX). I may consider still typesetting the print book in LaTeX after it’s all done, since I really do like the output, but I’ll probably give the print functionality in Vellum a shot first.

In between writing and editing, I’ll also be getting graphics made. Many of them I can do myself in LaTeX, but the cover and some images I outsource to a professional graphic designer (fortunately for me, I happen to be married to one).

Edit

I’ve always been a pretty clean writer; my first drafts are pretty close to most people’s final drafts. It doesn’t matter; your work needs to be edited. Preferably, it needs to be edited by somebody who is not you. It’s entirely too easy to read what you meant instead of what you actually wrote. When that’s not possible, at least put the work aside for a while so you can forget what you wrote, then read it in a different medium. For the last book I wrote, my process was:

  1. Write the chapter.
  2. Put it aside for a bit
  3. Print it out and edit the printout.
  4. Repeat step 3 until I stop finding errors. (Remember I used to be an editor)
  5. Send it to my technical editor. Make changes based on his feedback.
  6. Send it to my copy editor. Make changes based on her feedback.
  7. Convert to an ebook. Fix anything that Word, Vellum, or Amazon’s processing software flags.
  8. Read on my Kindle. Fix anything that looks off there.
  9. Publish!

As you can see, the entire process is somewhat involved. I don’t always go to this much trouble – my science fiction, which I publish under a pen name, I don’t even have an outside editor for – but for technical material in particular I really want to make sure that everything is correct. Self-published books have had a bad reputation due to being rushed out without proper editing, and I aim to have mine be as good or better than anything that’s traditionally published.

Publish

Now it’s time to publish! This is actually the easiest part of the process.

If you already have an Amazon account, you can go to kdp.amazon.com and log in. Making your book available for sale is a simple matter of filling out a three-page form and then waiting a few days for it to be approved. Here you’ll need to know things like your price, whether you want your ebook to be enrolled in Kindle Unlimited, etc. If it’s your first time, you’ll probably spend a while figuring out the best options for your book.

Amazon is the big dog in book publishing, but not the only one. I want my paperbacks to be available from places that don’t want to purchase from Amazon, and I also want hardcovers, which aren’t available from Amazon. So my books are also printed at Ingram Spark. Unlike Amazon, which is free to publish with, Ingram charges a setup fee (and a change fee if you need to make updates later) but you can generally find coupons; I have not yet paid Ingram anything except printing and shipping fees. There are also other places to sell ebooks, including Apple and Kobo. Figuring out your publishing strategy is outside the scope of this article.