I’ve been working on a project with Adobe Catalyst, and if I didn’t do something for a Design Pattern tour now, it would be put off until I don’t know when. So I put together a non-design pattern application incorporating video and code snippets from the Aid Game. I simply have not had time (given the work I’m doing with Catalyst) to put together a more generic design pattern “thrill ride” that I planned; so while I’m working with Catalyst, I thought I’d might as well do something with design patterns and came up with this more mild tour instead of my planned thrill ride. Figure 1 shows what it looks like:

Figure 1: Tour through State Design Pattern
As you can see it’s pretty simple—sort of a PowerPoint chat. (Nowhere near as flexible as the one created with the Memento pattern.) So, if you’re interested in a mild tour, click the Play button and hop on:

By the way, the Catalyst project has made me far more aware of Flash Builder/Flex code. It uses Flex in its engine. If you’re interested in Catalyst, you can download the Beta at Adobe Labs. I tried importing programs (SWF files) made with design patterns, and it works great. About the only thing I didn’t do with this tour is to put the videos on Flash Media Server—sorry. I was in a hurry and wasn’t sure how to link up FMS to Catalyst. I could have written the code in Flash/Flex and created an SWF file to import into Catalyst, and that works fine, but I’m pretty pressed for time on this project.
As always, your comments and valuable feedback is encouraged. I’ll be back working on this blog as soon as I’m finished with the Catalyst project. Besides, Chandima has been writing knock-out posts to keep you interested!
My initial idea of having a “thrill ride” through a design pattern to help reveal its operation is turning out to be awkward in more ways than I envisioned. The initial tour is going to be through a State Design Pattern; so naturally I set it up using a State pattern. It wasn’t too long before I realized that it would be difficult to visit all of the participants without adding new states that would show visiting the Context and State interface. In other words, I needed VisitContext and VisitState state classes.
After some fumbling, I saw that much of the important work is done by the Client. It actually works like a composer, especially since the State design is a beautiful example of both composition and delegation. Each participant had some responsibility in the process that I wanted to reveal in the sequence in which it occurs. With the State design, this is especially challenging because the context changes with each state. So how does one go about making a tour of such a process?
What Varies?
Then it occurred to me that were I to spend time on setting up a tour of the State design pattern, why not create a reusable application that I could use on any pattern I wanted? Of course this brought me back to the most basic question of design pattern development—what varies? In other words what varies in a tour of a pattern? So I whipped out my Magic Table to look at the possible variations in a design pattern. Well, I knew that the patterns were going to vary, but what does that look like in the Magic Table? Here were some that stood out:
I’ll get to the decisions involved in deciding on the best design pattern for making my thrill ride through different design patterns in a bit, but first, I wanted to consider the initial animations, graphics and design. The embedded SWF shows what I have in mind. The “control panel” is made up of buttons representing the different states (The animation just goes from the Client to the Context but it gives an idea of the animation I’m considering. It only goes to one state and then this page has to be reloaded to start over.)
[swfobj src="http://www.as3dp.com/wp-content/uploads/2010/02/ClientTest4.swf" align="none" allowfullscreen="true"]
Read more…
Recent Comments