the Strategy Pattern in PHP 5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ltruett@fluffycat.com

    the Strategy Pattern in PHP 5

    I'm almost done my series of design patterns using PHP 5. Today's
    pattern is the Strategy Pattern.



    In the Stratedy Pattern a "family of algorythms" is used interchangably
    by calling clients.

    This is the second pattern in as many days as I've used my older work
    with patterns in Java, and again I liked the old example when I first
    looked at it, but now I wonder about it. In this example the context
    is passed a parameter at instantiation, and the context then chooses a
    concrete strategy which it hold on to for every time it needs a
    strategy. This means that the calling client would need to call the
    appropriate context. Not sure if this is the real intent here, might
    have to revisit this one...

Working...