- When we want o create numerous objects that are alike or differ from each other only based on the state
- Alternative to numerous factories that mirror the classes to be instantiated
- Create one object upfront and designate it as the prototype object. For all further instances just copy the object.
- Shallow copy vs Deep copy
- Shallow copy - top-level object and it’s primitives are cloned. For low-level objects only the reference is cloned.
Advantages
- Avoids sub-classes of an object creator in the client application
- Avoids the inherent cost of using the
new
to create a new object