DevShed kicks off another three-parts series today with part one of a look at working with builder objects in PHP5.
In this article, the first of a three-part series, you will be introduced to the basics of creating directors and builder objects with PHP 5. As usual, there will be copious examples to help you quickly start using the builder pattern in your own PHP projects.
Well, to put things in a simple perspective, when the builder pattern is applied, two objects are put into action to create a third one. First, these two objects create a director; as its name suggests, the director controls all aspects of the creation process and determines what pieces and modifications will be introduced into the target object. Finally, a builder is tasked with constructing the third object in question, in accordance with particular specifications. Sounds fairly simple, doesn't it?
They start with a look at starting with the Builder pattern, building a basic XML document to provide the structure for the target object. From that information, they show how to create the object and give a simple class to help direct that object along.