The more I search the more confused I become. Is the factory design pattern the superclass of Abstract factory and factory method? Or it is the other name for static factory?
-
What do you mean by the factory design pattern and static factory? Those names are not used to identify unique patterns (I mean there's no common agreement). GoF for example identifies Factory Method and Abstract Factory design patterns. – Jun 06 '14 at 09:41
-
In objective-c, class clusters are used as abstract factories. See this answer: http://stackoverflow.com/a/23094194/1059025 – quellish Aug 16 '14 at 05:52
1 Answers
So to reduce confusion:
Factory Method and Abstract Factory are two different uniquely named design patterns. Unique names are important to identify them from the other. Both of them belong to the object creational design patterns category (or class). While being creational design patterns, they are solutions to very different object creation related problems.
The names "factory design pattern" or "static factory" are not commonly used to indicate unique design patterns. Generally, the term "factory" is used to refer to anything that creates objects (So you may talk about a factory class, factory object, factory method and so on but know clearly that there's a unique design pattern with the name "factory method" as well).
Also, the term "static factory" may openly be used to talk about a class with a static method that has an object creational responsibility even though a widely accepted unique pattern does not exist with that name.
There's no authority that assigns names to design patterns. It's only that some design patterns become popular and then their names are popularly used to reference them.
Design patterns that do not gain popularity may still use names but others may unknowingly use the same names to refer to different things. So the names "factory design pattern" and "static factory" are still open for the public to use as they prefer until someone registers them as trade marks :)