Creational Design Patterns Flashcards

1
Q

What are the types of creational design patterns?

A
Abstract factory
Builder
Factory method
Prototype
Singleton
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Give an example of the abstract factory pattern

A

An abstract class that subclasses extend that provides a template for making a concrete factory

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

Give an example of a singleton. And how are singletons made that way?

A

Private constructor. Or abstracted by framework. And an example is an angular service.

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

What is the prototype pattern, and how is it used

A

When you want to make new objects by calling .clone on an existing object. Many JavaScript array methods work this way- array.map is a great example.

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