Re: Can use of singletons denote poor project design?
- From: "Daniel Parker" <danielaparker@xxxxxxxxx>
- Date: 24 Feb 2006 12:08:28 -0800
Phlip wrote:
[X-posted to comp.object and followups set]I don't really see how there are any special issues for writing unit
John Fly wrote:
Right now I use [singletons] for :
Logging server : A central message storage and distribution to N number
of reports/logs)
Program State : Again a central point to keep track of program status.
Central Data representation
To pass fake data into the modules that use those systems, would you push
the fake data into the singleton, and let the modules use it?
That situation could be improved. In general, if the reason to declare a
Singleton is "because there's only one of them", then test cases always
violate this prerequisite because there's always many of them!
tests for singletons. For example, in Java, DateFormat.getInstance()
returns a default date format, which is a singleton object, there is
one instance of a default date format. Are you suggesting that you
would have difficulty testing whether this object satisfied its
specified properties? Why?
Regards,
Daniel Parker
.
- Follow-Ups:
- Prev by Date: Re: software architecture/design question
- Next by Date: Re: Can use of singletons denote poor project design?
- Previous by thread: software architecture/design question
- Next by thread: Re: Can use of singletons denote poor project design?
- Index(es):
Relevant Pages
|