I still get questions about writing a programming book, two years after Maximizing ASP.NET came out. I figure maybe it's time to write a blog post on it so I can easily field such questions with a little more substance.
Instead of giving advice on whether or not you should do it, let me share my experience and you can decide.
First off, consider what your motivation is. It's my opinion that you really need to want to help people out, and be confident that's what you can do. Everything should be secondary to that. You probably aren't going to get rich from doing it.
In my experience, the largest benefit to me was having that "publication" at the top of my resume. In the event that you want full-time or high-end consulting work, for me at least I've been able to write my own ticket. I still need to be charming in interviews, but a lot of weight comes with that publication.
You'll need to have a fairly clear vision of what you want to write, and where it will fit in the market. When my book came out, we were on the tail end of over-saturation with a ton of titles, many of which never sold that well. If publishers don't see where it can fit, they won't pick up the project.
I started by outlining what I wanted, and writing the introduction and two chapters. I shopped that around to various publishers, and was pretty amazed at the responses. Most hilarious was one publisher, who published a lot of books at the time (I won't say which one, but you'd be shocked), who told me to come back in five years when I had more experience. He was outright insulting. The reason I didn't take it all that personally though was that he couldn't even spell. There's a difference between "your" and "you're," after all. That was not someone I wanted to work with.
Obviously, Addison-Wesley was ultimately the publisher that picked up the project, after some peer-review that went on for about two or three months. The idea was to make the project more focused. Imagine that just four years prior to that, I bought my first ASP 3.0 book by Alex Homer, and now the guy was among those looking at what I proposed. That was kind of intimidating.
The thing I screwed up on is not retaining copyright, but I didn't know any better then. I figured I was lucky just to get a contract. I was given an advance and fairly healthy royalty percentage, oddly enough higher than what I remember reading was average at the time. Unfortunately, even a couple of years later, it hasn't quite reached the point where it made more than the advance, but again, that was never the intention for writing the book.
I had about six months to write, and I took time off from working to do it. What a great summer that was. At the same time, I was playing relentlessly with something called "Whidbey," which we now know as Visual Studio 2005 and .NET 2.0. Also somewhat amusing now, is that I was talking about rewriting POP Forums for the new framework version. Here we are three years later and we're on the verge of the next release, and no new forum app. Ha!
Writing for a publisher is an interesting process. First off, copy editors do a marvelous job helping you make things clear. Granted, I've been writing since college (double-majored in radio/TV and journalism), so the editing wasn't bad, but they certainly made me a better writer. Then seeing things laid out on pages, it was just so surreal. Creating something tangible like that is a pretty cool experience.
The entire project took about a year and a half from the time I started pitching in late 2003 to the time it appeared on shelves in March, 2005. At least for my experience, that was where the positive experience ended.
The marketing of the book was very poorly handled. At first they were pitching it at conferences with architects and experienced people, which were so far from the target audience that I could only scratch my head. You should've seen the first draft of the back cover copy. It read like total marketing B.S. that would've painted me to be a phony. It was terrible.
But there were some very shining moments. I got a lot of e-mail from people who bought the book and sincerely thanked me for writing it. Regardless of the scope of the audience, it was valued by some people. It's analogous to my experience coaching volleyball to girls. If even a few become better, it's worth your trouble.
One of my college professors actually sent a copy of the book to me to sign and send back to him. How crazy is that? One of your mentors suddenly looks up to you for something.
Inevitably, one of the questions I get is, "What would you do differently?" As I mentioned, I would've negotiated to retain the copyright. If I still had it today, I'd give the book away in PDF form. It's not going to sell much more anyway.
I'd also think about self-publishing. If I were to publish the same book today on LuLu.com, and price it at $30, I'd make about $20 a copy. That's ten times what I'd get in royalties through a mainstream publisher. I wouldn't have the marketing arm or publicity of a major publisher, but I would only have to sell one-tenth as much to make the same money. Again, the money wasn't the primary motivator, but my time is still worth something.
I wrote the book for the me of several years earlier. I was fortunate in being able to use the style and teaching that I thought would be effective. Certainly as time has passed, I have more experience, and I'm a better code monkey. I could probably write a better book. The question is, will I?
Hard to say. I think I'd co-write a book if I had the opportunity and was approached, but I don't know that I'd do one solo.
So my advice, even though I said I wouldn't give any, is to do it if you think can. It's a more impressive feat than you might think when you look back on it.