Writing a Programming Book in 2021
I wrote a couple of books recently and have some tips for aspiring authors:<p>* Start by blogging.  Try to get thousands of daily pageviews with an average time on page > 5 minutes.  Objectively verify you're able to write content that's engaging.<p>* Try to fill a niche.  My book is focused on practical advice for getting productive with Spark using the Scala API quickly.  There are other books that cover theory, discuss all 4 language APIs simultaneously, and are API documentation narratives (e.g. Chapter 4 will cover all the DataFrame methods in alphabetical order).  Most people don't have the attention span for huge books.<p>* Target middle school reading level.  Short sentences & simple words.  Technical audiences want information and don't care much about literary prose.<p>* Organize your code snippets in a repo, so it's easy to update your book<p>I got some offers from publishers, but went the self-publishing route cause I didn't think that a publisher could give too much valuable feedback on such a technical topic.  Lots of my blog readers told me my blogs are easy to follow, so I felt confident I didn't need a professional editor.  Publishers pay 20% royalties and self publishing lets you keep 80%+, so you should only go with a publisher if they can add that extra value.<p>Writing a book was a great experience for me.  It's an easy way to train folks who are new to Spark.  Several folks have emailed me, told me they can't afford the book, and I've sent them free copies.  Don't think writing books is a great way to make money, but it's great if you have altruistic motives.