Re: Can use of singletons denote poor project design?
- From: Andrew McDonagh <news@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 24 Feb 2006 22:38:46 +0000
Daniel Parker wrote:
Phlip wrote:
Daniel Parker wrote:
I don't really see how there are any special issues for writing unit
tests for singletons.
Someone on comp.lang.c++ just pointed out, very politely, "I think you just
like using global variables because you're lazy".
Interesting. Do you think the designers of Java were lazy by
introducing the concept of a default DateFormat singleton object
accessible by a DateFormat.getInstance() member? Do you have a better
idea?
Regards,
Daniel Parker
http://servingxml.sourceforge.net/
Not lazy...no
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.
This discussion of a Singleton and related abuses is using the wrong example.
What is lazy, is when people use singletons '..because its nicer than passing the thing around...'.
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.
.
- Follow-Ups:
- Re: Can use of singletons denote poor project design?
- From: Daniel Parker
- Re: Can use of singletons denote poor project design?
- 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?
- 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
|