Builder design pattern

Tuesday, February 25, 2020

Design patterns GOF

Design Patterns

Following the Gang of Four.

  • Creational 
  • Structural
  • Behavioral 

  1. Creational The purpose to create object in a way that is suitable to the current situation, which could lead to unnecessary complexity and the need for extra knowledge if they are not there. The main idea behind this category is - 
  • Knowledge encapsulation about the concrete class. 
  • Hiding details about the actual creation and how objects are combined. 

Following are the patterns fall in this category. 
  1. The abstract factory design pattern. 
  2. The factory method design pattern. 
  3. The lazy initialization design pattern. 
  4. The singleton design pattern. 
  5. The object pool design pattern. 
  6. The builder design pattern. 
  7. The prototype design pattern.  

Builder design pattern

Builder design Pattern 
Builder pattern build a complex object using simple objects and using step by step approach. For example: XML builder, Meal builder.
We provide API through which small objects can be added to complex object.

Builder Pattern UML Diagram