Creational Design Patterns Flashcards
1
Q
What are the types of creational design patterns?
A
Abstract factory Builder Factory method Prototype Singleton
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
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.
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.