Re: Singleton Pattern



Chris Uppal wrote:
Lionel wrote:

SingletonClass singletonInstance = SingletonClass.getInstance();
singletonInstance.saveObject(objectInstance);

So I got sick of this and changed the methods to static methods to
produce equivalent code:

SingletonClass.saveObject(objectInstance);

I don't see anything much wrong with that. Or at least not inherently. I
would hope that you've kept the old interface available for code which doesn't
use the Single instance. So that the second form is just a short-cut for the
former, rather than a redesign of the application to hard-wire the knowledge
that there /cannot/ be another instance (the first form only hard-wires the
knowledge that there is /a/ special instance, but not that there is only one).

Just a reply to acknowledge that I've read the two responses to my previous post and to say thanks :).

Lionel.
.