Skip to content

Latest commit

 

History

History

prototype

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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