Re: Is a static method sufficient to call it factory?
- From: Andrea Desole <news@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jul 2005 14:22:01 +0200
f.vivoli@xxxxxxxxx wrote:
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...
Actually, one of the reasons to use a singleton is that the getInstance method can return a subclass. So some subclassing is really used, which makes it more similar to a factory method.
Looks a bit strange implementation, though. The singleton should always return the same instance, whereas the factory patterns are made to work with more subclasses.
.
- Follow-Ups:
- Re: Is a static method sufficient to call it factory?
- From: f . vivoli
- Re: Is a static method sufficient to call it factory?
- References:
- Is a static method sufficient to call it factory?
- From: f . vivoli
- Is a static method sufficient to call it factory?
- Prev by Date: Eclipse components
- Next by Date: About Apache Maven scm plugin
- Previous by thread: Is a static method sufficient to call it factory?
- Next by thread: Re: Is a static method sufficient to call it factory?
- Index(es):
Relevant Pages
|