Comparison
Builder patternvsTelescoping constructor
Builder pattern
you set five things by name across five lines and call build, and the object does not exist until the last one.
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.
Full entry →Telescoping constructor
there are six constructors, each calling the next with one more default, and you count commas to find your argument.
The pattern of overloading a constructor repeatedly to fake optional parameters, each version delegating to a longer one. It scales badly the moment two optional parameters have the same type, because the call site becomes positional guesswork and the compiler cannot help. It is the specific problem the builder pattern was popularised to fix, and in languages with named or default arguments it simply does not arise.
Full entry →