April 2017
Intermediate to advanced
564 pages
24h 7m
English
The Builder pattern is used in situations where the creation of a complex object is required, and the creation is generally achieved through a number of steps until the final product is ready.
A classic example is that of a car as a final product, which is created in steps by adding the engine, chassis, body, tires, and so on. The main client asks for the product and receives the final product with all the creation steps hidden from it. This is achieved via a Director class.
The basic builder pattern involves a Director, Builder, and Product class, as shown in the following diagram:

Let's look at an example in the code. We ...
Read now
Unlock full access