- When would you use the Builder pattern why not just use a factory pattern?
- What is the benefit of factory pattern?
- How does a facade pattern work?
- What is the use of prototype design pattern?
- When would you use the GOF prototype design pattern?
- What are the consequences of applying the builder design pattern?
When would you use the Builder pattern why not just use a factory pattern?
You have to create plenty of nodes and attributes to get your final object.
A factory is used when the factory can easily create the entire object within one method call.
This builder would then spit out the HTML for me.
This is much easier to read than walking through a large procedural method..
What is the benefit of factory pattern?
Advantage of Factory Design Pattern Factory Method Pattern allows the sub-classes to choose the type of objects to create. It promotes the loose-coupling by eliminating the need to bind application-specific classes into the code.
How does a facade pattern work?
Facade pattern hides the complexities of the system and provides an interface to the client using which the client can access the system. … This pattern involves a single class which provides simplified methods required by client and delegates calls to methods of existing system classes.
What is the use of prototype design pattern?
The prototype design pattern enables you to create a new instance of a class from an existing instance. You can take advantage of this design pattern to create a clone of an object when the object creation process itself is a costly affair.
When would you use the GOF prototype design pattern?
Use Prototype Pattern when a system should be independent of how its products are created, composed, and represented, and:Classes to be instantiated are specified at run-time.Avoiding the creation of a factory hierarchy is needed.It is more convenient to copy an existing instance than to create a new one.
What are the consequences of applying the builder design pattern?
Here are key consequences of the Builder pattern:It lets you vary a product’s internal representation. The Builder object provides the director with an abstract interface for constructing the product. … It isolates code for construction and representation. … It gives you finer control over the construction process.