- Building Microservices with Spring
- Dinesh Rajput Rajesh R V
- 146字
- 2021-07-02 14:54:04
Builder design pattern
Separate the construction of a complex object from its representation so that the same construction process can create different representations. - GOF Design Patterns
The Builder design pattern is used to construct a complex object step by step, and finally it will return the complete object. The logic and process of object creation should be generic so that you can use it to create different concrete implementations of the same object type. This pattern simplifies the construction of complex objects and it hides the details of the object's construction from the client caller code. When you are using this pattern, remember you have to build it one step at a time, which means you have to break the object construction login into multiple phases, unlike other patterns, such as the abstract factory and the factory method pattern, which the object in a single step.