Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Abstract factory pattern
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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== The abstract factory design pattern is one of the 23 patterns described in the 1994 ''[[Design Patterns]]'' book. It may be used to solve problems such as:<ref>{{cite web|title=The Abstract Factory design pattern - Problem, Solution, and Applicability|url=http://w3sdesign.com/?gr=c01&ugr=proble|website=w3sDesign.com|access-date=2017-08-11}}</ref> * How can an application be independent of how its objects are created? * How can a class be independent of how the objects that it requires are created? * How can families of related or dependent objects be created? Creating objects directly within the class that requires the objects is inflexible. Doing so commits the class to particular objects and makes it impossible to change the instantiation later without changing the class. It prevents the class from being reusable if other objects are required, and it makes the class difficult to test because real objects cannot be replaced with mock objects. A factory is the location of a concrete class in the code at which [[object creation|objects are constructed]]. Implementation of the pattern intends to insulate the creation of objects from their usage and to create families of related objects without depending on their concrete classes.<ref name="bullet points" /> This allows for new [[Subtyping|derived types]] to be introduced with no change to the code that uses the [[base class]]. The pattern describes how to solve such problems: * [[Encapsulation (computer programming)|Encapsulate]] object creation in a separate (factory) object by defining and implementing an interface for creating objects. * Delegate object creation to a factory object instead of creating objects directly. This makes a class independent of how its objects are created. A class may be configured with a factory object, which it uses to create objects, and the factory object can be exchanged at runtime. {{See also|#UML diagram}}
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Abstract factory pattern
(section)
Add topic