I had a lot of fun writing my first book, Game Development with Three.js. Here are some things I learned:
Writing
Before I started writing, I created an outline for the book including page counts for each chapter. I stuck pretty closely to that outline and ended up pretty close to the page counts. However, it was still hard to figure out what to leave out. I realized as I was writing that there was a lot more relevant material I could cover. Initially I hand-waved, with too many comments along the lines of "this is something you can do, but I'm not going to explain it now." Eventually I realized that this didn't add anything to the readers' experience, so I either expanded those notes into a full explanation or removed them altogether. I also included too few images initially, partially due to layout constraints, and I underestimated how much room examples would take up. Despite those initial concerns, I had a lot of fun writing about a topic I've been excited about for awhile! Preparing the outline and writing technical material wasn't too hard since I was familiar with the topic. Clearly I didn't have to come up with a story arc like I would if I was writing a novel, although I did try to keep the material interesting and not too dry.
Editing
I expected that I would write a fairly quick first draft and the publisher would send it back to me all marked up in red, and then we'd go back and forth for several revisions until we were both happy with it. Instead, the editing happened in two rounds: first the content was reviewed, and then the language was edited. To review the content, I chose two technical reviewers who left comments throughout each chapter. I was expected to either change the relevant sections accordingly or leave my own comments explaining why I didn't. After this process I went back and polished each chapter on my own before sending it back to Packt. When all the chapters had been reviewed for content, two editors at Packt went through and checked for language issues. There weren't very many changes at this stage, although I had to revert a few of them that changed the meaning of technical language. Adding in two other people at Packt who coordinated everything, there were six people other than me who helped complete the editing process.
I had to rewrite some chapters more than others. In the first draft of the first two chapters I was still figuring out the right amount of explanation required, and the third chapter has a long example that at first I didn't integrate well into the instructional part of the chapter. The editing definitely helped me make the book much better. I was only told what the process would be for the next few weeks at a time though, so at first I wasn't sure how much editing there would be.
Time
The publisher-imposed deadlines for writing and editing each chapter were very short (for each chapter, I had about a week for writing, a few days for editing content, and about a day for editing language). I'm told that the deadlines for the technical reviewers were short as well. I liked this because I wanted to finish the book before school ramped back up, and I don't think I would have used more time if I had it. I never missed a writing deadline and I only missed two editing deadlines by a few hours (basically due to time zone differences).
However, meeting the short deadlines required a lot of discipline. Usually I would write most of a chapter on Sunday and then spend a few days filling out incomplete sections or editing before sending the chapter to Packt. Twice I stayed up all night in order to get in a chapter or revision on time; this was self-imposed, and by no means encouraged by the publisher -- I don't think they really would have minded if it was slightly late as long as I stayed in communication about it. Even when I didn't have to do that, I probably spent 15-25 hours per week writing the first drafts, maybe 10 hours on each chapter's content revision, and maybe 5 hours on each language revision. I also spent a lot of time communicating, developing the outline, and researching. All in all, this was manageable for me, but I did sometimes have to stay in and write instead of going out with friends, or sacrifice sleep. Overall though, it wasn't too overwhelming, and I finished the whole book (118 pages) in 3 months.
Oddly enough, one thing I didn't account for (that caused one of my sleepless nights) was that writing custom code for examples could take as long as writing the prose. I wrote about a thousand lines of code for Chapter 3, which took most of a week, but most of the English took only a day. When I was done with the code, I realized I didn't know how to incorporate it into the chapter. If I had put the whole example in the book, it would have been as long as the entire chapter was supposed to be. After talking to Packt I ended up leaving out some uninteresting bits and highlighting the most interesting parts (the whole example can be downloaded online).
Communication
I tried to let my coordinators at Packt know when things came up that might affect the book, and they were good about confirming my submissions and respecting my schedule. They seemed excited with the progress of the book so it was easy to work with them. On the other hand, in retrospect I didn't manage communication with my technical reviewers very well. I only talked to them at the beginning and end of the process, and I didn't explain my goals for the book, the intended audience, or how long it was intended to be. I don't think Packt did this either.
I also would have liked more people to read the book and give me high-level feedback before it was published. I don't think this would have affected much, but when you're putting a little piece of yourself out for the whole world to see, it's nice to know in advance whether people will love or ridicule you.
Reaction
Every person I told except one thought it was cool that I was writing a book. (The one exception was incredulous that anyone still reads books.) Lots of people wanted to know if I was self-publishing or had a "real" publisher. Everyone wanted to know what the book was about and when it would come out. A few wanted signed copies. Most of the people I talked to are outside of the target audience so they couldn't evaluate the quality of the book.
The second most common reaction was, "how do you have the time?" As I noted above, the time I spent on the book restricted how much time I could spend on other things, but I was disciplined enough not to waste time and I didn't have too many other time-intensive projects going on during the writing process.
The attention I got for writing the book surprised me, perhaps because technical writing felt familiar. I wasn't looking for attention so I tried not to bring it up too much (although it's hard not to bring it up when someone asks how your week is going and you've spent the last four days writing). Admittedly there aren't very many 21-year-old authors, but plenty of people do comparably interesting things. I did find it interesting that people focused on the book rather than the 12 years of game development that enabled me to write the book. However I am glad that my work was being appreciated! I just hope people will like the book after reading it. :-)
Result
I'm quite happy with how the book turned out, and I hope people will find it useful. The process wasn't too strenuous and I had fun writing! As a bonus, it was a great experience to get my knowledge onto paper (real, physical paper!) and learn about the process of writing and publishing a book.