Re: Can use of singletons denote poor project design?
- From: "Daniel Parker" <danielaparker@xxxxxxxxx>
- Date: 24 Feb 2006 14:48:59 -0800
Andrew McDonagh wrote:
Daniel Parker wrote:
Do you think the designers of Java were lazy byNot lazy...no
introducing the concept of a default DateFormat singleton object
accessible by a DateFormat.getInstance() member?
A default formatter is purely an optimisation. But we can still have
other DateFormats, its just that there's always the same single default
available.
Right, the default is global.
This discussion of a Singleton and related abuses is using the wrong
example.
I think it's using the right example.
Sometimes it is. Do you want the default DateFormat to be passed in
What is lazy, is when people use singletons '..because its nicer than
passing the thing around...'.
main()?
I've lost count of the number of times I've had the conversation with
developers who swear blind that global variable are the devil's spawn
and yet fail to see that a singleton is nothing more than a global variable.
Of course they're global, but Singleton's do offer some advantages over
naked global variables. Better packaging.
Regards,
Daniel Parker
http://servingxml.sourceforge.net/
.
- Follow-Ups:
- References:
- Re: Can use of singletons denote poor project design?
- From: Daniel Parker
- Re: Can use of singletons denote poor project design?
- From: Phlip
- Re: Can use of singletons denote poor project design?
- From: Daniel Parker
- Re: Can use of singletons denote poor project design?
- From: Andrew McDonagh
- Re: Can use of singletons denote poor project design?
- Prev by Date: Re: Can use of singletons denote poor project design?
- Next by Date: Re: Can use of singletons denote poor project design?
- Previous by thread: Re: Can use of singletons denote poor project design?
- Next by thread: Re: Can use of singletons denote poor project design?
- Index(es):
Relevant Pages
|