Difference between revisions of "Prototype"

From CDOT Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 +
<h1>Prototype Design Pattern</h1>
 +
 +
----
 +
 +
'''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 ==
 +
 
[[Image:prototype.jpg]]
 
[[Image:prototype.jpg]]
 +
 +
 +
== Sample code ==
 +
 +
 +
 +
 +
== Related Patterns ==

Revision as of 22:47, 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