Difference between revisions of "Prototype"

From CDOT Wiki
Jump to: navigation, search
(Related Patterns)
(Side effects)
Line 14: Line 14:
  
  
== Side effects ==
+
== Side Effects ==
 
 
 
 
 
 
  
 
== Pattern diagram ==
 
== Pattern diagram ==

Revision as of 22:50, 17 March 2007

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

  • a

  • b

  • c