add Prototype pattern

This commit is contained in:
Jakub Vojvoda
2016-09-08 10:16:18 +02:00
parent ce74cf0ee5
commit c6b242d7a1
2 changed files with 96 additions and 0 deletions

12
prototype/README.md Normal file
View File

@@ -0,0 +1,12 @@
## Prototype
Specify the kinds of objects to create using a prototypical instance, and create
new objects by copying this prototype. Pattern has creational purpose and deals
with object relationships, which are more dynamic. The pattern hides the complexities
of making new instances from the client.
### When to use
* when the classes to instantiate are specified at run-time
* to avoid building a class hierarchy of factories that parallels the class hierarchy of products
* when instances of a class can have one of only a few different combinations of state