Chapter 2. Selected Design Patterns
Life is like an ever-shifting kaleidoscope—a slight change, and all patterns alter.
Design patterns suggest an approach to common problems that arise during software development regardless of programming language. For example, when you need to ensure that your application allows only one instance of a particular class, you need to implement a singleton design pattern. If you need to pass the data between different objects, you create data transfer objects (a.k.a. value objects). There are a number of books written about design patterns and their implementation in different programming languages, including ActionScript 3.0; see ActionScript 3.0 Design Patterns by William Sanders and Chandima Cumaranatunge (O’Reilly). This chapter is not yet another tutorial on patterns. The goal of this chapter is to highlight selected patterns, as you (the developer) may implement them to take advantage of the Flex framework.
While going through the examples shown in this chapter, please keep in mind that Flex is a domain-specific tool that’s aimed at creating rich UI for the Web and providing efficient communication with the server-side systems.
We realize that there are people who don’t like using the dynamic features of ActionScript, arguing that it makes the code less readable. In our opinion, there are lots of cases when dynamic features of the language can make the code concise and elegant.
All code examples from this chapter are located in two ...