The main reason for creational patterns is to separate the creation of an instance from its consumption. ... Furthermore you could mock / stub out the creational objects itself, which could be used to deliver other mocks / stubs.
Why do we need creational design patterns?
The creational patterns aim to separate a system from how its objects are created, composed, and represented. They increase the system's flexibility in terms of the what, who, how, and when of object creation.
What are the features of creational patterns?
Creational patterns
- Abstract Factory. Creates an instance of several families of classes.
- Builder. Separates object construction from its representation.
- Factory Method. Creates an instance of several derived classes.
- Object Pool. ...
- Prototype. ...
- Singleton.