Understanding the solution
The builder pattern solves this problem by introducing an intermediary known as a builder type. This builder type contains most, if not all, of the information necessary to create an instance of the original complex type.
There are two methods that can be used to implement the builder pattern. The first method is to have multiple builder types where each of the builder types contains the information to configure the original complex type in a specific way. The second method implements the builder pattern with a single builder type that sets all of the configurable options to a default value which can then be changed as needed.
In this section, we will look at both ways to use the builder pattern because it is important ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access