Re: Is a static method sufficient to call it factory?
- From: Harald <pifpafpuf@xxxxxx>
- Date: Thu, 28 Jul 2005 21:26:13 GMT
f.vivoli@xxxxxxxxx writes:
> 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...
The difference is that your Factory may be the implementation of some
interface. In addition, you may want to hand the Factory object to
some other class that wants to use it. In both cases you need an
instance, even if it is always the same one.
Having said that, I realise that I would probably not call a static
method that happens to return an object --- even freshly created --- a
factory.-)
Harald.
--
---------------------+---------------------------------------------
Harald Kirsch (@home)|
Java Text Crunching: http://www.ebi.ac.uk/Rebholz-srv/whatizit/software
.
- 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: Re: inhibiting comment reflow
- Next by Date: WebServices and wsdl generation
- Previous by thread: Re: Is a static method sufficient to call it factory?
- Next by thread: J2ME background image
- Index(es):
Relevant Pages
|
|