January 06, 2015

Design Patterns - Abstract Factory Pattern

A more special and complex version of the Factory Pattern. The additional complexity is that the not only does the client now know the actual object being created but also does not know the Factory which is creating the object i.e. the Factory now also configurable.

Used in Dependency Injection. The pattern does not have the actual types that it needs to create but might have some way to create them based on information passed to it like the type name.

In .NET reflection can be used to create instances using type names as strings see Activator.CreateInstance.