Markus fdb9be1e76 Work towards #56: Add permalink to every pattern
This makes cleaner URLs thanks to jekyll
2015-08-15 18:03:05 +02:00

715 B

layout, title, folder, permalink, categories, tags
layout title folder permalink categories tags
pattern Factory Method factory-method /patterns/factory-method/ creational pattern_tag

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

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