I've recently has a book published; if you're interested in seeing what it is, you can find it here.
This post is simply a summary of things that I wished I'd known before I started writing. As a quick disclaimer, please don't treat this article as legal or financial advice. It's simply a list of things that I, personally, have encountered; if you're in a similar situation, I would encourage you to seek advice in the same way that I have, but hopefully this article will give you a starting point.
I'll also mention that I'm in the UK, so some of the points here may be specific to location (certainly the figures that I'm giving are in sterling, and rough approximations).
Choosing a Topic
Did I mention this was all subjective?
In my case, the topic was chosen for me; however, I would suggest that, where you have a choice, you pick something that isn't time sensitive.
Let me try to illustrate what I mean: when I started writing the above book, .Net Core 3 was available only in preview, so I'd write a chapter, test the software, and then Microsoft would release a breaking change! I can't describe in words how frustrating that is - you spend, maybe two or three weeks preparing and writing a chapter, and then you have to re-write it, almost from scratch!
Further, .Net Core 3 had a release date: obviously, once it's released, there's a sweet spot, where people want to read about the new tech - I can't help but think that the new release cadence by Microsoft, whilst helpful for those using the tech, is just too fast for anyone to write any kind of lasting documentation.
Finally, think of the books that you remember in the industry: Domain Driven Design,
Design patterns : elements of reusable object-oriented software,
Test Driven Development: By Example; these are all books that are not technology specific - The GOF book was released in 1994, but it's still relevant today!
Most of this section will discuss contracts.
The Contract Itself
You may want to consult a solicitor to get professional advice on this. When I asked around, I was quoted around £200 - £300 for a solicitor to review the contract and offer me advice. However, there is another option: The Society of Authors offers contract reviews as part of the membership fee (which was around £100 at the time of writing).
If you get a book contract, the contract itself will say that you, personally, are liable for anything: if they get sued, you're liable. There's essentially three approaches to address this:
1. Professional Indemnity Insurance
This is a private insurance policy that you take out, against being sued. It is not cheap, and you should account for this expense when you decide to embark on writing a book. My impression is that you are very unlikely to actually be sued: the book itself will have a disclaimer against any accidental damage; plus, providing you don't simply copy and paste blog posts and put them in your book without attribution (that is, your work must be original, or have the permission of the author to replicate it), you're unlikely to fall foul of any copywrite issues.
2. A Limited Company
I've done a lot of research into this and, to be honest, I'm still not completely sure about it. A limited company has limited liability, so if you were to be sued, providing that you signed the contract on behalf of the company, you, personally, should be safe. I have, however, seen (and received) advice saying that the director of the limited company may bear some personal liability for any losses to the company.
Additionally, setting up a limited company is not a cheap option: although setting up the company itself only costs ~£10 (in the UK), you must submit company accounts - you can actually go to prison if you get that wrong - so you may end up forking out for an accountant (budget between £500 - £1000 / year for that!)
3. Do Nothing
I strongly suspect this is what most people do. Technically it does leave you personally liable.
Once you get offered a book contract, you will be given an advance. In addition, you will be entitled to royalties of any book sales. Here's how that works:
Imagine your advance is £1000, and you get 10% from book sales. Let's say the book is consistently £50 retail.
After the first 200 books have sold, your royalties will reach your advance - meaning that you will start to receive some money per sale.
If the book sells 150 copies, then you still receive the advance, but no further money.
Remember as well that any money that you earn needs to be declared to HMRC - so you'll need to request a self-assessment.
If you have a full time job, it's worth bearing in mind that writing and publishing a book is probably in breach of your contract; consequently, you'll have to speak to your employer before you sign any contract.
My process for editing my blog posts (and any fiction that I write - some of which can be seen here) is that I write them in One Note, or Word, and then I transfer them to the Wordpress site, come back in about an hour and read the preview - if it looks good to me, then it goes out.
The editing process I encountered with a publisher was, obviously, different. There seems to be a formula to the layout that they require. For example, if you have a series of actions, they like them to be in numbered steps. I assume to a greater or lesser extent, every publisher does essentially the same thing.
It's also worth bearing in mind that the editing process might change some of your text without your consent - you need to be aware this is a possibility. It's also a very likely possibility that, some months after you've finished on a chapter, you'll be asked to revisit it. On occasion, I found myself following my own chapter to try and remember some of the material - which I suppose is a good thing: like when you go searching for something on the internet, and you come across your own post!
One way or another, you're going to have to take an interest in promoting your work. If you're a fiction writer, that means book signings, etc. However, if you publish a tech book, that means talks, podcasts, and blog posts (such as this)! While I have done a flash talk on (essentially this blog post), I would probably advise against giving a talk on "My Book", rather, pick a subject, and simply mention that you have also written a book (if the subject you chose is in the book then that's probably better, but not essential!)
If you do decide to embark on writing a book, it is hugely rewarding, you learn a lot of things, and make new contacts. However, be prepared for some late nights and lost weekends. Also, don't be under the impression that you can make any money out of this: you're very likely to be out of pocket by the time you finish.