| Posted by FluffyCat on 05/04/06 03:26 
Last fall I started a series of design pattern examples using PHP5.  Ithink the last pattern I did was the Singleton in January.  Getting
 back to it here is my first cut at the Builder pattern.
 
 http://www.fluffycat.com/PHP-Design-Patterns-Builder/
 
 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.
 [Back to original message] |