Charles Petzold



Interactivityishness

December 30, 2005
Roscoe, NY

In Married With Children, one gag that was always good for a laugh showed Peggy Bundy sitting on her couch watching a TV exercise program while eating bon-bons.

A similar but perhaps more subtle gag would be someone sitting on a couch reading a book entitled How to Juggle or Play the Oboe without an oboe or practice beanbags in sight.

Even more subtle to the point where it's not all that funny — perhaps also because we've probably all done it at one time or another — is someone sitting on a couch reading Programming This Month's Windows API with no computer around.

Programming tutorials are most effective when the user is actively typing in code and trying out the examples while reading the explanations. These days, programming is often taught in classrooms that contain computers for every student. The beauty of a book is that it allows that same experience in the privacy of one's home. But there's got to be coding and typing involved as well as reading.

This conviction leads me to my 5th (and at this point, final) self-imposed rule for writing my Windows Presentation Foundation book:

Rule No. 5: Get the reader involved.

But how? I would love, love, love to not make available the collection of downloadable sample code. In order to see the programs running, the reader would then be forced to type in the entire program. It sounds harsh, but that would be a much better way to learn the material than just loading the solution in VS and pressing Ctrl-F5.

But people would be really angry if we did that. So I'm taking a little different approach with this book. I still have complete sample programs, of course, and plenty of them. But in many cases the programs are only skeletons for audience participation. In the text, I describe different variations of the program with the addition and subtraction of various statements. For example, when introducing the Image element, I have a simple program that pulls a picture off my Web site (the one with the tattoo) but in the text I describe how to do stuff like this:

I hope the temptation of seeing a bitmap rotated 45° with a simple statement like this is enough to get the reader off the couch and in front of the computer to actually type in the code.

I'm also avoiding screen shots in the book. My feeling is: If you want to see what the program looks like, run it yourself. Why do programming books have screen shots at all? They're so tedious to do, and it's my least favorite part of "writing". And really, all they do is make the book look really old when Microsoft changes the UI styles.

But whether my publisher will actually allow a book to be published "without pictures or conversations" (as Alice would say), I have my doubts.