Sunday, February 27, 2005

What do you want to see? (in my PyCon slides)

With PyCon just a few weeks away, I've been throwing together my slides for the presentation on generic functions, and I'm short a few examples and diagrams. The tricky part is that you can't fit much text on a slide, so I need to come up with some nice pithy example uses of generic functions.

Well, actually, there are two tricky parts. One is that the examples need to be short, but the really tricky part is that they need to be pretty self-explanatory. Most of my real-life uses for generic functions take a bit too much explaining (e.g. command-line options, security rules, etc.). But I suppose they're still a bit better than the "interactive fiction" examples I posted here previously.

Maybe I could also steal some ideas from SanFrancisco Design Patterns, which has some patterns like Key/Keyable and Keyed Attribute Retrieval that could be easily implemented with generic functions or rule dispatchers. (That book, by the way, was what first got me interested in rule-based dispatch systems. Its proposed implementations were very clunky and not at all agile, though, so when I came across predicate dispatch I knew it was a better approach.)

I probably also need some visual aides just to break up the reams of text on my slides, though. I had been thinking I'd write a tool to output a generic function's internal decision tree as a GraphViz chart, but there are still some refactorings I'd have to do first that I probably won't have time for. So, I may have to just make up a chart manually. But that really only means one illustration, out of maybe 30 slides. Maybe if I colorize the Python code on the code samples, it'll make them look different enough to break up the monotony. :)

What do you think? Have you got any ideas for uses or examples you'd like to see?