Answers to Design Patterns Quiz

1. The common prefixes make, create, and get reflect which specific design pattern?The Factory Method pattern

2. Primitive operations, which are prefixed with do, are used by which pattern?The Template Method pattern

3. Separate the instantiation from its assembly to promote flexibility in Listing 9-1.

Listing 9-1. AbstractClass

public class AbstractClass extends Sprite {     public function AbstractClass()     {         var someMovieClip : MovieClip = new ConcreteMovieClip();             someMovieClip.y = 25;               someMovieClip.x = 40;               someMovieClip.play();                         addChild( someMovieClip );     } }

Listing 9-2. AbstractClass

Listing 9-3. FactoryMethodClass.as

Get AdvancED ActionScript 3.0: Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.