Design patterns·Making things
you set five things by name across five lines and call build, and the object does not exist until the last one.
Builder pattern
Also calledbuilder, step builder
Separating the construction of a complex object from its representation, so the object is assembled step by step and only produced when complete. Two distinct motivations get the same name: making a long parameter list readable, and letting one construction process produce different representations. Its underrated benefit is that the built object can be immutable and fully validated, because there is no half-built instance for anyone to see.