Please enable JavaScript.
Coggle requires JavaScript to display documents.
Builder Pattern - Coggle Diagram
Builder Pattern
Related To
-
Abstract Factory helps in creating families of objects, while Builder focuses on constructing complex objects
You can use Builder pattern to construct Composite trees because you can make the construction process recursive
You can combine Builder and Bridge patterns. The director can be the abstraction and different builder classes can be the implemention
Abstract Factory, Builder, and Prototype can all be implemented as singletons
Opportunities
To allow lots of configuration, your constructor might be huge with so many parameters
It's hard to create the object, because it requires so many steps
-
-
-
Solution
-
-
You don't have to call all the steps, you simply have to call the steps you need. (i.e build windows, build floor, but don't build roof)
You can also have different builder class variations i.e a class where we build house using wood, stone, etc...
You can also have a direction which runs the steps for you, it just needs a builder class.
-
-
-
-