Creational Design Patterns Flashcards

1
Q

What is the Builder Pattern

A

Builder is a creational design pattern that lets you construct complex objects step by step. The pattern allows you to produce different types and representations of an object using the same construction code.

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

What is the Prototype Pattern?

A

Prototype is a creational design pattern that lets you copy existing objects without making your code dependent on their classes.
This is done by implementing an interface with a clone() method, which lets you create an exact copy of the object which calls the method.

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

What is the Singleton Pattern

A

Singleton is a creational design pattern that lets you ensure that a class has only one instance, while providing a global access point to this instance.
This is done by either making the default constructor private, to prevent other objects from using the new operator with the Singleton class, or by creating a static creation method that acts as a constructor. Under the hood, this method calls the private constructor to create an object and saves it in a static field. All following calls to this method return the cached object

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