Great Factory Definition
Was reading “Refactoring To Patterns” and came across a great definition for the often misused term “Factory”.
A class that implements one or more Creation Methods is a Factory.
This leads to needing a few more definitions:
- Creation Method – any method (static or non-static) that creates an instance of an object.
- Factory Method – non-static method that returns a base class/interface type for the purposes of facilitating polymorphism. Implemented by class and one or more subclasses. Factory Method is NOT a Factory however.
- Abstract Factory – interface for creating related or dependent objects without specifying their concrete classes. Designed to be substitutable at run-time. Abstract Factories are Factories.
Comments(0)