Posts

Showing posts with the label Builder Pattern

Design Patterns Series 12 - Builder Pattern

Today we have a date with another pattern that give you a clever way of dealing with adapting the process of creating objects. previous post we explored The Template Method pattern  today we will explore its twin,  Builder Pattern . Builder Pattern: We use the Template Method Pattern when we have a multi-steps algorithm with in a certain order and we want to customize some steps. But what about if the number of steps and its order differs from one case to another?!!!!!. In Builder Pattern you don't inherit a template method anymore and then customize that method to create your own object. Instead, to create different types of objects, you allow client code to use different builder objects. The client code now sets the number and sequence of the steps in the algorithm, and selects which builder to use. The Builder Pattern let you " Separate the construction of a complex object from its representation so that the same construction processes can create ...