Is a static method sufficient to call it factory?



Hi everyone,

I've just a doubt...

Talking about factories why someone propose the way

Factory.getInstance().createClass(aType);

instead of simply

Factory.createClass(aType);

That is,
why the singleton?

In the end, is a class with a static method eligible to be an use of a
factory method pattern? It doesn't resemble the structure of the GOF
pattern, since it doesn't use subclassing...

Suppose that what createClass() method does is to instantiate a
concrete class
based on the parameter.


cheers,
Francesco

.



Relevant Pages

  • Re: Has anyone ever implemented a Decorator pattern in VB?
    ... > public method that returns an instance that implements the expected ... Class factories generalise this idea by having a single object whose sole responsibility it is to create other objects. ... that you don't have to keep track of each singleton class, but let the class factory do this for you allowing you to simply ask the ...
    (microsoft.public.vb.general.discussion)
  • Re: Singletons
    ... when those conditions prevail Singleton is usually the best ... Like Abstract Factories implementations, Object ... WindowManager, so if WindowManager is a Singleton there is only one ... orthogonal to the number of instances of the leaf subclasses. ...
    (comp.object)