How I wrote 'The Computer Science Book' while travelling

March 3, 2021

Tale of emacs, tears and credit card fraud.

Previously I wrote about how to develop ideas for passive income. Now that you’ve got your idea, what happens?

In this post, I’ll describe the process that ended up with ‘The Computer Science Book’. Writing an entire book seems an impossible task when it stands before you. So many, many words! I hope that pulling back the curtain of the sausage-making factory [link both similes to youtube videos] will help show you how to plot a course.

  • Researched major topics
  • Wanted each chapter to be readable in a single sitting, so max 30 pages. Guesstimated a word count of 10,000 words. Remember doing this on my honeymoon. My wife is eternally patient. 10 chapters so 100,000 words!!
  • Tried to come up with initial structure but too early. But tried to imagine 3 x 2500 word blog posts, with some topping and tailing would be 10k. More approachable.
  • All the advice is to write a blog and gain readers. This is probably better advice than anything I did. But I knew that it wouldn’t work for me. Needed to improve writing and improve command of concepts.
  • Probably would have been discouraged if i didn’t get loads of readers.
  • Start reading. Started off with theory of computation as it was one of my less knowledgeable areas. Used my initial enthusiasm. Should I have blogged about stuff I was more solid about?
  • As we travelled, I read PDFs on my phone and made notes on beorg (org-mode frontend for iOS). When we had long bus journeys, I would stay up late writing notes into rough drafts. Wouldn’t sleep anyway.
  • Really, really annoying how iOS iBooks reader keeps reloading itself. Eventually switched to MarginNote, which was much better for note-taking.
  • A major consequence of this is that I associate different parts of computer science with various places we saw.
    • Computability is the Medellin metro.
    • TCP/IP is lake Titicaca.
    • Dynamic arrays are Cusco (and many pisco sours. So good).
    • OS processes are Uganda.
    • Database WALs are getting the ferry in Thailand.
  • I thought the content I had written wasn’t good enough to publish in blog format. That was correct, but I see now that my issue was trying to write posts that were too long and covered too much. Perhaps I should have tried writing up my work in posts of ~1000 words without thinking yet about overall structure.
  • Wrote everything in emacs org-mode. Emacs is how I do all my work and it just made sense.
  • For each chapter, I at first just copied over my notes and did a general structure. That exposed things I wasn’t completely sure about if I couldn’t explain them well. Iterated overt that a few times until I had everything I wanted to cover in there somewhere.
  • Then the Great Refactor. Went through the whole chapter, rewriting everything at once, holding all the state in my head. Long bus journeys again! A bit like when you refactor in a big way and everything is totally broken until it all falls back into place.
  • Later got better at planning things out with detailed subheadings and doing the structure up front. I would like to have been better at this earlier.
  • Every chapter went through multiple rewrites. First to get everything in, then to improve the structure and then to make it read well. Early drafts in particular were really bad and sometimes confused.
  • Originally exported to latex. Then used org-mode to export to github markdown and build with Leanpub. Had to add a Perl githook to tweak output to match Leanpub idiosyncrasies.
  • Interspersed “tough” chapters with ones I found easier to write.
  • Tried to be like Tim Ferris and use google ads for book name. “Essentials of CS” very popular in India, “computer science made easy” in U.S. Cultural differences. Forgot to check whether domains were available.
  • On return, had 7 chapters drafted in various states. It helped to have various chapters at different stages of progress. Depending on how I felt, I could do some reading and note-taking, proof read a paragraph or two, or write up notes into actual text.
  • By this point I had it on Leanpub with the best chapters. My first sale genuinely made me cry. Demonstrated that someone would pay for it!
  • Doing the Great Refactor rewrites gave me sick feeling. I hated doing those but invariably got really into it once I’d built up the “state” of the chapter in my head.
  • Took long breaks. I was enjoying travelling. For the final few chapters, Dad was ill in March and I went home to NI. Didn’t really feel capable for a while.
  • Eventually came to finish final two chapters over Covid summer. Then more proof-reading and redrafting.
  • Published on Amazon in October, so ~18 months’ work.
  • Healthy sales on Leanpub but they turned out to be fraudulent [keep this?]


think incremental. always try to leave things so that you have a low effort entry point on return. use leanpub use emacs