ActionScript 3.0 Design Patterns

(Chris Devlin) #1

42 | Chapter 1: Object-Oriented Programming, Design Patterns, and ActionScript 3.0


In addition to messages in the Output window, you should see something like


Figure 1-6 on the stage.


In addition to the visible graphics, you should also hear the sound played by the


MP3 file. (This multimedia experience has been brought to you by polymorphism


and the letterP.)


Principles of Design Pattern Development


The founding principles of design patterns are laid down in the Gang of Four’s (GoF)


canon,Design Patterns: Elements of Reusable Object-Oriented Software. The two


essential principles are:



  • Program to an interface, not an implementation

  • Favor object composition over class inheritance


If you skipped the section on the four basic OOP principles because you already


know them, the first principle of Design Pattern OOP was introduced, but only


briefly. Not to worry, we’ll go over it in detail.


Before going further, we need to clarify some basic terms. While these terms are


fairly simple, they can trip you up if you don’t understand how they’re used in


Figure 1-6. Graphic file and video appear on the stage

Free download pdf