The Builder Design Pattern using PHP5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • FluffyCat

    The Builder Design Pattern using PHP5

    Last fall I started a series of design pattern examples using PHP5. I
    think the last pattern I did was the Singleton in January. Getting
    back to it here is my first cut at the Builder pattern.



    In the builder pattern a director and builder work togther to build an
    object. The director controls the building and specifies any
    variations that can be done with the object. The builder knows how to
    build the object.

    There are a couple things I'm not 100% sure of yet in my example.

    I use of a formatPage() function in my HTMLPage.php. I'm not sure if
    it should be there or in the builder.

    I only have a HTMLPage builder shown, but perhaps to be a complete
    example a contrasting XMLPage or RSSPage builder would be helpful.
Working...