Builder
Builder is a creational design pattern that simplifies the creation of complex objects by providing a fluent interface, which allows us to build the object step by step. This greatly improves the readability and the general developer experience when creating such complex objects.
The most apparent situation in which we could benefit from the Builder pattern is a class with a constructor that has a long list of arguments, or takes many complex parameters as input. Usually, these kinds of classes require so many parameters in advance because all of them are necessary to build an instance that is complete and in a consistent state, so it's necessary to take this into account when considering potential solutions.
So, let's see the general structure of the pattern. Imagine having a Boat
class with a constructor such as the following:
class Boat {
constructor (hasMotor, motorCount, motorBrand, motorModel,
hasSails, sailsCount, sailsMaterial...