I recently completed the final touches on my book, A Common-Sense Guide to Data Structures and Algorithms, 2nd Edition, published by The Pragmatic Programmers. As of this writing, the book is available in “beta” format on the publisher’s website, and the book will be going to print in a short while.
As my work is now complete, and I await holding a printed copy of the book in my hands, I’ve been reflecting on the various aspects of what went into writing a book of this nature. I’ve decided to share some of these thoughts, as readers may be interested in the book writing process, and perhaps my thoughts will inspire the next software developer to become a published author.
Perhaps the most important lesson I’ve learned from writing a book is that you - yes, you - can actually write a book. Before I got involved with writing, the idea of being a published author was certainly not on my radar. In my mind, book authors belonged to some elite class, a group of people who are gifted with the written word. On top of that, I took for granted that nonfiction authors, and especially authors of computer programming books, are authorities in their areas of expertise. People who wrote such books were masters of their craft, and beyond flaw.
But then I wrote a programming book. Mind you, I didn’t set out to write a book - I wasn’t an author, after all. I just sort of fell into it. I had decided to help coding bootcamp graduates by providing supplemental material on data structures and algorithms, topics that generally aren’t covered with the same level of depth as they are in universities.
I started a Google Doc where I introduced these topics in a clean, plain-English way. Now, I was no expert in these topics (gasp!). I had taken courses on data structures and algorithms when I was in college, but had forgotten a lot of what I’d known. Luckily, I still had my college textbook to help me get started in the right direction, and of course, I had the internet.
I had to do a lot of research to write on these topics. My primary modus operandi was to read and understand other material covering these areas, and then put them in my own words so as to explain them in as clear a fashion as possible. I was not inventing new topics or covering unexplored ground; I was simply translating and re-explaining existing resources in a way that newly-minted coding bootcamp grads could understand.
I worked on this Google Doc for months, devoting many weekends to it, until I had a document that I could share with others. I was done! It was hard work, but I was proud of my little “cheat sheet” on data structures and algorithms. Some of the bootcamp grads even told me that it was good.
Some time later, and I don’t recall exactly how and when this happened, it occurred to me that I might be able to turn my Google Doc into a book. I had noticed that my manuscript had amounted to about 100 pages, so there definitely was a little heft to it. I think that I’d been subscribed to the weekly newsletter put out by The Pragmatic Programmers, where on the bottom it says “You can be a published author.” It could be that after seeing that message numerous times, something clicked in my head.
On a whim, I decided to send my little manuscript over to The Pragmatic Programmers. I enjoyed a number of their titles that I’d already owned, and they were the ones, after all, telling me that I could be an author.
I hesitated a little before sending them my Google Doc. It’s hard to put yourself out there, and especially in a way where you might be outrightly rejected. I was proud of my little document, but was it really up to snuff to be a published work? Almost certainly, they’d say, “thanks, but no thanks.” Or worse, they may not respond at all.
I finally convinced myself that I wouldn’t be physically harmed by sending the manuscript over. I knew that I also wouldn’t suffer permanent psychological damage from being rejected, but I did brace myself for rejection nonetheless. So I sent the publisher an email. I explained who I was, what the “book” was about, and I attached a pdf of my manuscript.
My breath caught when I almost immediately received an email response, but then realized that it was merely an automated email. However, an editor from the publishing company did reach out the next day to say that they’d consider the book in their next proposals meeting.
Days passed, and I almost forgot about the whole thing. After all, I had just sent them the Google Doc on a whim. I hadn’t set out to write a book.
However, eight days later, the editor informed me that my book could actually be a good fit for the publisher. Naturally, I was elated.
I was surprised to learn, though, that the book wouldn’t stand as is. It would have to be entirely rewritten. In fact, the entire subject of the book wasn’t even a given. My book was not yet truly a book; it was merely a proposal.
I definitely took a punch to the gut in learning that my book wasn’t worth much as it was. I noted the irony of me feeling that way, though, since I never even had high hopes for my work being accepted in the first place. I felt a weird mix of validation and rejection simultaneously.
However, I told them that I would be happy to work with them and do what it takes to write a high-quality book on data structures and algorithms. And thus, the project began.
The publisher began by teaching me a lot about writing. And this is the second lesson I learned about becoming an author: you don’t have to already be an author to become an author. Writing is a learned skill. I was lucky to have editors who actively taught me how to write.
After a decent amount of prep work, I was given my first project. I was to write my first chapter - from the middle of the book. While I had expected to begin my book, well, at the beginning, I actually started my book from the middle. This proved to be invaluable, though, as it helped set the tone for the rest of the book, something that an introductory chapter might not have done.
My editor worked heavily with me on my writing style, and I had to revise the chapter over and over again. I then wrote additional chapters, also with heavy revisions and guidance. You definitely need to be humble to grow as a writer.
I can’t emphasize this enough, but the more you write, the more you learn to write. Again, I was not a writer (and still have more than enough room to grow) - but with practice and guidance, I was able to put together coherent chapters, and ultimately, a book.
The third thing I learned about writing a book is that you don’t write a book. Instead, you write sections. Once you’ve written enough sections, they can be grouped together to make a chapter. And once you’ve written enough chapters, they can be bound and published as a book. Writing an entire book is overwhelming, and I’m overwhelmed merely by seeing the completed book as a whole. “How did I write all of that?” I often ask myself incredulously. However, that’s now how it works. Instead, you write a little bit at a time, and before you know it, there’s enough material to fill a book.
The first edition was published in 2017, and I was thrilled to see that a lot of people liked it.
While people were enjoying the book, they also submitted a great number of errata. I was taken aback at how many mistakes I had made! This was another learning experience for me: if you write a programming book, you’re going to make lots of mistakes. But I learned that it’s okay, that’s the nature of writing a book with a myriad technical details. I’m grateful to all the readers who read the book so carefully and submitted the errata to make the book better and more accurate. Again, humility serves a critical role in being a successful author.
About a year ago, I decided to create a second edition of my book. There was more material that I wanted to add, and some original sections that I wanted to clarify. I was also interested in providing exercises (and solutions), which the first edition lacked.
I encountered a pleasant surprise when writing the second edition: my editor provided much less critique on my work! I discovered that I'd really grown as a writer, and needed less feedback. (Of course, the feedback that I did receive was invaluable.) I'm appreciative to my editor in helping me achieve this growth.
In writing the second edition, I was reminded of another learning that I apparently forgot from the first time around. Writing a book is really hard work! I’d forgotten how much effort it takes to research, write, and rewrite. However, the key, again, is to simply write section after section, and before you know it, you have a book.
I was also reminded another lesson about writing: there’s no better way to learn something than to write a book about it. As a teacher, I always used to say that there’s no better way to learn something than to teach it. But I’ve found that writing a book yields a whole new level of learning. When you’re writing a book, and creating a work that is to be authoritative and reliable, you’re forced into learning the material really really well.
A corollary of this is that, when starting out, you don’t need to be a world-class expert in the material you’re writing about. Through the research and writing that you do, the expertise will come.
For the book's second edition, I had only intended to add five new chapters and some exercises, but ended up with a book roughly twice the size of the original. In many ways, it was like writing a brand new book. Ultimately, I’m proud of the work I put in and the resulting book.
And that reminds me of the final lesson I’ve learned: writing a book is an extremely rewarding experience. Once you’ve done it, it’ll be one of the proudest accomplishments of your life.
If you’re even contemplating writing a book, take the first step and submit a proposal - you never know where it will lead you. And if you’re not contemplating writing a book, I encourage you to think about it. It may be counterintuitive, but I’ve learned that you don’t need to be a writer or subject matter expert before writing the book. The writing skills and expertise will come as part of the book-writing process.