Builder Pattern Flashcards

1
Q

builder pattern

A

used to build objects. Sometimes, the objects we create can be complex, made up of several sub-objects or require an elaborate construction process. The exercise of creating complex types can be simplified by using the builder pattern. A composite or an aggregate object is what a builder generally builds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

-builder pattern advantage

A

a builder pattern encapsulates or hides the process of building a complex object and separates the representation of the object and its construction. The separation allows us to construct different representations using the same construction process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The class diagram consists of

A

Builder
Concrete Builder
Director
Product

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The builder pattern might seem similar to the abstract factory pattern but one difference is that

A

the builder pattern creates an object step by step whereas the abstract factory pattern returns the object in one go.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Builder class

A

contains a method for each component that can be part of the final product. }

These methods are selectively overridden by concrete builders depending on if the builders will be including that part in the final product variant that they are responsible for building.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Director class

A

contains The process or algorithm required to construct the product

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Skipping the Director

A

You may find the builder pattern being used without the director. The client can directly instantiate the builder and invoke the required methods to get a product for itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly