Writing about server controls is no fun

I finally finished writing my book chapter on custom and composite server controls tonight. I hated every minute of it because it's not an easy thing to write about in a way that is simple and lets the reader "get it" quickly.

I looked through some of my old books for inspiration, and I think that was the reason I hated it. Eventually I put them on the shelf and started from scratch. I wanted to simplify.

For example, nearly every example you see includes creating an event and a handler. While that's certainly what makes control interaction possible, it's not necessary at first. If you want to show how to make a simple text box, you don't need a “TextChanged” event to process postback data. If you're not familiar with event wiring, you'd look at it and ask, “Why do I even need to do that?”

Composite control examples suffer from the same complexity. Inherit from CompositeControl, override CreateChildControls(), and go about your business. Once you've got that, then talk about overriding Render(), then talk about events.

This experience is showing me what I bet is the single biggest struggle for all authors: What exactly is the right amount of detail? In this particular chapter, I thought getting into events from the start was overkill. Someone might (no, will) disagree with that, but in working with developers trying to raise their game, too much, all at once, doesn't help them learn. The only reason I got into events at all was because at this point in the book the reader should understand how they're useful and how to wire-up code to them (because it was covered in writing HttpModules).

Now as I try to keep my sanity, would you believe I'm considering another book proposal?

No Comments