Markus 5ce932ceb7 Work on #213
- properly categorize all patterns
- remove pattern list from readme
- minor fixes to readme
- removed "introduction" because its not a pattern and an error i
committed some time ago
2015-08-20 21:40:07 +02:00

21 lines
708 B
Markdown

---
layout: pattern
title: Factory Method
folder: factory-method
permalink: /patterns/factory-method/
categories: Creational
tags: Java
---
**Intent:** Define an interface for creating an object, but let subclasses
decide which class to instantiate. Factory Method lets a class defer
instantiation to subclasses.
![alt text](./etc/factory-method_1.png "Factory Method")
**Applicability:** Use the Factory Method pattern when
* a class can't anticipate the class of objects it must create
* a class wants its subclasses to specify the objects it creates
* classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate