2015-08-13 23:54:40 +02:00
---
layout: pattern
title: Abstract Factory
folder: abstract-factory
2015-08-15 18:03:05 +02:00
permalink: /patterns/abstract-factory/
2015-08-20 21:40:07 +02:00
categories: Creational
2015-09-22 18:25:56 +05:30
tags:
- Java
- Gang Of Four
2015-08-13 23:54:40 +02:00
---
**Intent:** Provide an interface for creating families of related or dependent
objects without specifying their concrete classes.

**Applicability:** Use the Abstract Factory pattern when
* a system should be independent of how its products are created, composed and represented
* a system should be configured with one of multiple families of products
* a family of related product objects is designed to be used together, and you need to enforce this constraint
* you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations
**Real world examples:**
2015-08-15 18:03:05 +02:00
* [javax.xml.parsers.DocumentBuilderFactory ](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html )
2015-09-22 18:25:56 +05:30
**Credits**
* [Design Patterns: Elements of Reusable Object-Oriented Software ](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 )