Re: Unit Testing Frameworks (was Re: Singletons)
On 12/31/2012 3:28 PM, Seungbeom Kim wrote:
On 2012-12-30 00:28, Balog Pal wrote:
And importantly it is about the designated object, not its class, so
the usual struggle to make a "singleton class" that focuses to
*prevent* multiple instances creation are way off track. And are
only good to shadow those working on the original goal for special
cases.
Just a minute; Wikipedia defines the single pattern as "a design
pattern that restricts the instantiation of a class to one object." If
the class doesn't prevent multiple instances, then I don't see any
reason for it to be called a "singleton."
IMO the whole idea we call "design patterns" applies to software
engineering in general. Not to some subset of systems and languages that
have something called "class".
If we accept that as starting point, the wiki article starts on a wrong
foot. And continues to tell some *one* side of the story.
(I don't mean that such restriction is very useful, though.)
It isn't and I'd rather suggest it is just poorly phrased. (the list of
references is interesting for the starting paragraph, i.e. [7] GOF is
not referred :)
At the start of this thread I wrote about history as much as I recall it
-- we started talk Singletons when GOF was published. they summarized
existing practice by that time. And class-based implementations started
to surface only after that... While the pattern definitely existed in
the design domain.
Just interesting, by the end the article phrases the assertion we had
under debate (the one about hurting testability, as claimed by DI
pushers). I looked at the slides in the reference, and found it
completely specific to java (big surprise?), and not the best quality
either.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]