Command Pattern Slides Builder Pattern Intent Separate the construction of a complex object from its representation so that the same construction process can create different representations. Example Everybody to create a drawing. Here are the instructions for what to put in the drawing: 1)Draw the Sun 2)Draw two large Clouds and six small ones 3)Draw three Mountains 4)Draw a Lake 5)Draw a flock of Birds 6)Draw eight Trees Now, give me your drawing (not really). Would everyone’s drawings be the same? No. They would all certainly look different. Some might use a computer to create their drawing. Others might use paper and colored pencils. Others might use a canvas and oil paints. Intent (Revisited) Separate the construction of a complex objectfrom its representation so that the same construction processcan create different representations. Complex Object: Scenic Drawing Construction Process: My instructions on what objects to put in the picture and where to place them Different Representations: Computer, Paper/colored pencils, Canvas/oil paints, etc. Structure of the Builder Pattern Participants: Product: Complex object we are interested in building Director: Object that drives the construction process (i.e., contains the algorithm for constructing the complex object)
has intentionally blurred sections.
Sign up to view the full version.