Builder Design Pattern


GoF Statement: Separates the construction of a complex object from its representation so that the same construction process can create different representations.
Category: Creational
UML Diagram:  

Description of the Demonstration:

In this demonstration the Cook class is responsible for constructing different types of Pizza. The actual construction of the concrete objects is encapsulated in instances of sub-classes of PizzaBuilder. When the Cook is given an instance of a PizzaBuilder it can create the Pizza by calling the standard functions defined in the Builder. The sub-class of Builder is responsible for the actual construction of the concrete object.


Code:

Click here to download a zip file containing all the source files and an executable of the Demonstration. See the _ReadMe.txt file in the zip.