18 minutes ago, Gnollrunner said:
To me it's a really unimportant difference. People argue about this stuff, but in reality creating a second instance of some big class that there is only supposed to be one instance off, is one of the easier bugs you are going to run in to. I certainly wish that was the worst of my problems.
I think you're missing the point.
A singleton is a class that can only have one instance and the class itself enforces this. Anything else isn't a singleton.
The idea behind it isn't to stop you creating a "second instance of some big class", it's supposed to manage something that there can be only one of (it was sometimes called the "Highlander" pattern ). Typical examples are print queues, network interfaces, etc. But in reality, it causes more problems than it solves.
As you say, if someone creates a second instance of a class, that's actually not that big a problem (if the class is designed well in the first place). On the other hand, if someone designs a singleton on the assumption there'll never be another instance of that class, it leads to all kinds of problems when you inevitably do need a second instance.
if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight