Advice from Hal R. Varian, who has written several:
Some of the best advice I ever got about writing a textbook was from Richard Hamming, winner of the Turing Award, the closest thing computer science has to a Nobel prize. He said ``Get together the exercises and exams that you expect the students to be able to solve once they've read your book, then write the book that shows them how to solve them.'' The great thing about this advice is that it focuses you on the outcome you want to produce. If you understand both where you audience is coming from, as I advocated earlier, and where you want them to be, it's not that hard to write the book that helps them make the transition.