AS Quiz #4

This quiz contains a few questions about design patterns. I think the best intro book to design patterns is Head First Design Patterns. (the examples are in Java but it is an excellent resource/intro). After that its worth checking out GOF

Number of Questions : 7
Difficulty : If you know patterns this will be easy, if not, it will make very little sense to you.
Topic : Design Patterns

Fill in the blank. The Strategy pattern is used to change the ________ of an object at runtime.

The AS3 display list could be considered an implementation of which of the following design patterns:

Which of the following is true about the Adapter pattern?

Fill in the blank. Using the flyweight pattern can reduce a group of thousands of class instances down to __________.

True or False... The Decorator pattern and the Strategy pattern both make use of composition to add flexibility at runtime.

True or False... It's uncommon and considered bad practice to combine two or more design patterns to fit you needs.

True or False... When implementing MVC, you should only ever have one view running at a time.

This entry was posted in Quiz and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Posted January 14, 2010 at 2:55 pm | Permalink

    Ok, hrrrm, so I guess I’ve got to read up on design patterns…

  2. Posted January 14, 2010 at 3:07 pm | Permalink

    if you develop any medium to large size apps… design patterns will save you lots of pain and frustration… they’re worth reading up on. :D

  3. gropapa
    Posted January 15, 2010 at 3:33 am | Permalink

    for the question: Which of the following is true about the Adapter pattern?
    the naswers
    “It is used to map one objects method signatures to another.” & “It is used to change the interface of an object” do sound the same to me

  4. Posted January 15, 2010 at 7:47 am | Permalink

    They’re not the same, and even if they were… Adapter is more than just a class that wraps methods. Often, in an Adapter you’ll wrap method calls of the adaptee and some logic into one function of the interface. Say there is an Interface IDrawingObject that contains the method drawRect(x, y, width, height, color) - You might adapt some class capable of drawing colored rectangles to the IDrawingObject interface in the following way

    (psuedo-code inside the Adapter)
    function drawRect(x, y, with, height, color){
    adaptee.translate(x, y);
    adaptee.vertex(width, 0);
    adaptee.vertex(width, height);
    adaptee.vertex(0, height);

    Does that make sense? I hope that clears it up.

  5. jared
    Posted February 9, 2010 at 10:46 pm | Permalink

    terrible. 3/7

Post a Comment

Your email is never published nor shared. Required fields are marked *