Swifty Waves

Design Patterns - Creational

Based on stackoverflow post

Static Factory

Simple static method in base class.

static factory

Simple Factory

Basically the same as in previous patterns but now the static method is in their own class.

simple factory

Factory Method

The Simple Factory now delegates in their own subclasses the responsability of creating the classes (all subtypes of the main type).

factory method

Abstract Factory

Very similar with previous pattern but now each concrete factory create their own type of classes.

abstract factory

Resources

https://stackoverflow.com/questions/4209791/design-patterns-abstract-factory-vs-factory-method

http://oo-programming.blogspot.co.uk/2009/02/oo-design-principles.html

Tagged with: