p. Peter Goodman has posted an interesting little tutorial on his blog titled “Observers and Dispatchers”:http://www.flyingwithfire.com/2006/08/24/observers-and-dispatchers/. Like the recently released “Snakes on a Plane”:http://www.imdb.com/title/tt0417148/ it delivers exactly what you would expect. Except the tutorial is actually entertaining, from what I’ve heard, the movie isn’t.
p. In his tutorial, Peter introduces readers to the programmatic concepts of observers and dispatchers. He does so with a bit of humor and a lot of code. (yea code!) Here’s a quote.
bq. Maybe you’ve used a framework that uses Observers and Dispatchers, or you’ve heard of them but don’t know how they work. Well, I’m going to explain them and tell you why they’re so useful.
p. See, exactly what I told you he was going to do. From that launching point he goes on to create Observer and Dispatcher classes, walking you through each line of code and carefully explaining the concepts involved.
p. A tutorial on observers and dispatchers isn’t exactly breaking new ground, they’ve been around for a long time. But they haven’t been used a lot in Web programming until recently. They are, however, important concepts and if you are not familiar with them, this tutorial is a great launching point.
p. Peter goes long on the sample code (the “How”) but doesn’t skimp on the “Why” either. It’s a good balance and you come out with a solid understanding of the basic concepts.
p. My only criticism of the tutorial would be that the code is written in PHP 4. The classes don’t have __construct() methods and he uses & to pass by reference. It would be nice to see version updated for PHP 5. But alas, you can’t have everything. If you could, Samuel L. Jackson would have another “great movie role”:http://www.imdb.com/title/tt0116908/ instead of a string of ho-hum.