Am 11.10.2011 05:14, schrieb Johann MacDonagh:
Perhaps my design pattern knowledge is a bit shaky (it is), but isn't
the point of a factory to give it hints about what you want to create,
and it decides how to do it? Something like:
Database d = Factory.gimmeAConnection("MySql", "server", "username",
"pwd");
I guess you describe the "Factory method" pattern.
def :
Define an interface for creating an object, but let subclasses decide
which class to instantiate. Factory Method lets a class defer
instantiation to subclasses.
My snippet is based on the "Abstract Factory" pattern. Also called
"Factory design" pattern or simply "Factory" pattern . Indeed a bit
confusing.
def :
Provide an interface for creating families of related or dependent
objects without specifying their concrete classes.
see also > http://www.dofactory.com/Patterns/Patterns.aspx