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
Abstract factory 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!
{{Short description|Software design pattern}} [[Image:Abstract factory UML.svg|UML class diagram|thumb|right|317x317px]] The '''abstract factory pattern''' in [[software engineering]] is a design pattern that provides a way to create families of related objects without imposing their concrete classes, by encapsulating a group of individual [[factory object|factories]] that have a common theme without specifying their concrete classes.<ref name="abstract factory">{{cite book | last1 = Freeman | first1 = Eric | last2 = Robson | first2 = Elisabeth | last3 = Sierra | first3 = Kathy | last4 = Bates | first4 = Bert | editor1-last = Hendrickson | editor1-first = Mike | editor2-last = Loukides | editor2-first = Mike | year = 2004 | title = Head First Design Patterns | volume = 1 | page = 156 | publisher = O'REILLY | format = paperback | isbn = 978-0-596-00712-6 | access-date = 2012-09-12 | url = http://shop.oreilly.com/product/9780596007126.do }}</ref> According to this pattern, a client software component creates a concrete implementation of the abstract factory and then uses the generic [[Interface (object-oriented programming)|interface]] of the factory to create the concrete [[Object (computer science)|object]]s that are part of the family. The [[client (computing)|client]] does not know which concrete objects it receives from each of these internal factories, as it uses only the generic interfaces of their products.<ref name="abstract factory" /> This [[software design pattern|pattern]] separates the details of implementation of a set of objects from their general usage and relies on object composition, as object creation is implemented in methods exposed in the factory interface.<ref name="bullet points">{{cite book | last1 = Freeman | first1 = Eric | last2 = Robson | first2 = Elisabeth | last3 = Sierra | first3 = Kathy | last4 = Bates | first4 = Bert | editor1-last = Hendrickson | editor1-first = Mike | editor2-last = Loukides | editor2-first = Mike | year = 2004 | title = Head First Design Patterns | volume = 1 | page = 162 | publisher = O'REILLY | format = paperback | isbn = 978-0-596-00712-6 | access-date = 2012-09-12 | url = http://shop.oreilly.com/product/9780596007126.do }}</ref> Use of this pattern enables interchangeable concrete implementations without changing the code that uses them, even at [[Run time (program lifecycle phase)|runtime]]. However, employment of this pattern, as with similar [[Design pattern (computer science)|design pattern]]s, may result in unnecessary complexity and extra work in the initial writing of code. Additionally, higher levels of separation and abstraction can result in systems that are more difficult to debug and maintain.
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)