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!

The The ActionScript 3.0 Design Pattern Thrill Ride: Part II—Catalyst by William B. Sanders, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

Bill Sanders
Hey Bill,
Great video! I really love the power of having a state pattern that doesn’t use conditional statements. Really cool.
Just curious though what if there happened to be a TON of states. For funs sake what if there were 360 different states in this current pattern (one for every degree in a circle? Would there be another approach to take or just a lot of code? 360 functions for every 360 classes is 129600 functions!!!
Hi Jordan,
One of the important skills to develop in using design patterns is knowing which one to use. It’s not always easy. If you don’t have the starter kit, be sure to download it, and ask yourself (in the context of your project), What varies?. Then using the variation table, see which design pattern best addresses the variation. If you had 360 classes, with 130 thousand methods, I don’t think that a State dp would be the answer—or any other pattern for that matter. Because you have 360 degrees to handle doesn’t mean you need 360 classes. However, you could have objects that would change with the state. If you plan to have each degree be a separate object (class), you’re going to have your hands full no matter what you do.
If you had to have a State design pattern with 360 different objects and each object with 360 methods, you’d have most likely broken the OOP principle that states, each class should have only a single responsibility.
Kindest regards,
Bill