Re: Singleton Pattern
- From: Lionel <lionelv_@xxxxxxxxx>
- Date: Wed, 29 Nov 2006 13:10:46 +1000
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.
.
- Prev by Date: Re: Newbie: cloning a Number
- Next by Date: Re: lost in XML
- Previous by thread: Re: Newbie: cloning a Number
- Next by thread: Re: Singleton Pattern
- Index(es):