Summary


The State pattern is a great way to manage states within your application. By encapsulating the states into their own objects, we make the code more scalable and maintainable. There are many ways to implement the State pattern. In this chapter, we looked at how to build states using both an interface and an abstract class; and we discussed when to use each of these approaches.

Transitions are the action of switching states. They can be defined in the context or inside the state objects. Although defining transitions inside the state objects gives you more flexibility, doing so can produce code that is difficult to maintain.




Advanced ActionScript 3 with Design Patterns
Advanced ActionScript 3 with Design Patterns
ISBN: 0321426568
EAN: 2147483647
Year: 2004
Pages: 132

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net