From Design Patterns (Gamma et al)‏ Presented by David Kemp Melbourne Patterns Group
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. Design Patterns, Gamma et al, Chapter 4.
 
Creational Patterns Abstract Factory Builder Factory Method Prototype Singleton
 
Image from Flickr by Bob Henry Photography (http://flickr.com/photos/bobasonic/170043435/)‏ Some rights reserved (http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en)‏
Alternative to Factory Method and Abstract Factory. Can be used to implement Abstract Factory. To avoid building a class hierarchy of factories. Can be used when loading classes dynamically Often can use class objects instead.
Image from Flickr by Slowburn / Andreas Schaefer ( http://flickr.com/photos/slowburn/70150248/ )‏ Some rights reserved (http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en)‏
Add/Remove prototypes at runtime. Specify new prototypes by varying data. Specify new prototypes by varying structure. Less classes (less sub-classing!)‏ Dynamic class loading.
Discussion Factory Method: delegate to subclasses. AbstractFactory, Builder, and Prototype: delegate to another class. Prototype: reduces the total number of classes. Builder: Good when construction logic is complex.

Prototype Design Pattern

  • 1.
    From Design Patterns(Gamma et al)‏ Presented by David Kemp Melbourne Patterns Group
  • 2.
    Specify the kindsof objects to create using a prototypical instance, and create new objects by copying this prototype. Design Patterns, Gamma et al, Chapter 4.
  • 3.
  • 4.
    Creational Patterns AbstractFactory Builder Factory Method Prototype Singleton
  • 5.
  • 6.
    Image from Flickrby Bob Henry Photography (http://flickr.com/photos/bobasonic/170043435/)‏ Some rights reserved (http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en)‏
  • 7.
    Alternative to FactoryMethod and Abstract Factory. Can be used to implement Abstract Factory. To avoid building a class hierarchy of factories. Can be used when loading classes dynamically Often can use class objects instead.
  • 8.
    Image from Flickrby Slowburn / Andreas Schaefer ( http://flickr.com/photos/slowburn/70150248/ )‏ Some rights reserved (http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en)‏
  • 9.
    Add/Remove prototypes atruntime. Specify new prototypes by varying data. Specify new prototypes by varying structure. Less classes (less sub-classing!)‏ Dynamic class loading.
  • 10.
    Discussion Factory Method:delegate to subclasses. AbstractFactory, Builder, and Prototype: delegate to another class. Prototype: reduces the total number of classes. Builder: Good when construction logic is complex.