$> git checkout prototype
Intent
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.1
Applications
Use the prototype pattern when you want to fork and modify existing objects. A good use for this pattern is when you want to avoid the construction of a class that takes a lot of time or is complicated to create initially. An example of an object with a costly creation is one that uses a web service to fetch data. Once you have the data, though, you no longer need to fetch data from the web service; you just clone the data. There is another ...