Instantiating complex objects with the builder pattern
The builder pattern helps separate the construction of a complex object from its code representation so that the same composition process can be reused to create different configurations of an object type. The builder design pattern was identified early and is the part of GoF’s book.
Motivation
The main motivation behind the builder pattern is to construct complex instances without polluting the constructor. It helps to separate or even break down the creation process into specific steps. The composition of objects is transparent to the client and allows the creation of different configurations of the same type. The builder is represented by a separate class. It can help to transparently extend the constructor on demand. The pattern helps to encapsulate and enforce the clarity of the instantiation process with respect to the previously discussed SOLID design principles.
Finding it in the JDK
The builder pattern...