Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Creational pattern
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Overview== Creational design patterns are composed of two dominant ideas. One is encapsulating knowledge about which concrete [[Class (computer programming)|classes]] the system uses. Another is hiding how [[Instance (computer science)|instances]] of these concrete classes are created and combined.<ref>{{cite book|title=Design Patterns|year=1995|publisher=Addison-Wesley|location=Massachusetts|isbn=978-0-201-63361-0|last1=Gamma|first1=Erich|last2=Helm|first2=Richard|last3=Johnson|first3=Ralph|last4=Vlissides|first4=John|page=[https://archive.org/details/designpatternsel00gamm/page/81 81]|access-date=2015-05-22|url=https://archive.org/details/designpatternsel00gamm/page/81}}</ref> Creational design patterns are further categorized into object-creational patterns and class-creational patterns, where object-creational patterns deal with object creation and class-creational patterns deal with class-instantiation. In greater details, object-creational patterns defer part of its object creation to another object, while class-creational patterns defer its object creation to subclasses.<ref>{{cite book|title=Design Patterns|year=1995|publisher=Addison-Wesley|location=Massachusetts|isbn=978-0-201-63361-0|last1=Gamma|first1=Erich|last2=Helm|first2=Richard|last3=Johnson|first3=Ralph|last4=Vlissides|first4=John|access-date=2015-05-22|url=https://archive.org/details/designpatternsel00gamm}}</ref> Five well-known design patterns that are parts of creational patterns are the * [[abstract factory pattern]], which provides an interface for creating related or dependent objects without specifying the objects' concrete classes.<ref> {{cite book|last1=Freeman|first1=Eric|last2=Freeman|first2=Elisabeth|last3=Sierra|first3=Kathy|last4=Bates|first4=Bert|editor-last=Hendrickson|editor-first=Mike|editor2-last=Loukides|editor2-first=Mike|year=2004|title=Head First Design Patterns|publisher=O'Reilly Media|location=California|isbn=978-0-596-00712-6|page=156|access-date=2015-05-22|url=http://shop.oreilly.com/product/9780596007126.do}}</ref> * [[builder pattern]], which separates the construction of a complex object from its representation so that the same construction process can create different representations. * [[factory method pattern]], which allows a class to defer instantiation to subclasses.<ref> {{cite book|last1=Freeman|first1=Eric|last2=Freeman|first2=Elisabeth|last3=Sierra|first3=Kathy|last4=Bates|first4=Bert|editor-last=Hendrickson|editor-first=Mike|editor2-last=Loukides|editor2-first=Mike|year=2004|title=Head First Design Patterns|publisher=O'Reilly Media|location=California|isbn=978-0-596-00712-6|page=134|access-date=2015-05-22|url=http://shop.oreilly.com/product/9780596007126.do}}</ref> * [[prototype pattern]], which specifies the kind of object to create using a prototypical instance, and creates new objects by cloning this prototype. * [[singleton pattern]], which ensures that a class only has one instance, and provides a global point of access to it.<ref> {{cite book|last1=Freeman|first1=Eric|last2=Freeman|first2=Elisabeth|last3=Sierra|first3=Kathy|last4=Bates|first4=Bert|editor-last=Hendrickson|editor-first=Mike|editor2-last=Loukides|editor2-first=Mike|year=2004|title=Head First Design Patterns|publisher=O'Reilly Media|location=California|isbn=978-0-596-00712-6|page=177|access-date=2015-05-22|url=http://shop.oreilly.com/product/9780596007126.do}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)