Prototype

From CDOT Wiki
Revision as of 22:47, 17 March 2007 by Aashaye1 (talk | contribs)
Jump to: navigation, search

Prototype Design Pattern


Definition: Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. -- "Design Patterns" Gamma et al., Addison-Wesley, ISBN:0-201-63361-2" 

Friendly Definition: Prototype pattern is a creational pattern. Meaning it deals with the most efficient ways to create object in a given situation. when you do not want to directly call an objects' constructor , you can use this pattern to clone an existing object of that class thus reducing the number of classes. The basic principle behind this pattern is to determine the type of objects to be created by using a prototypical reference.


Advantages

Side effects

Pattern diagram

Prototype.jpg


Sample code

Related Patterns