Re: resetting ivars safely
Re: resetting ivars safely
- Subject: Re: resetting ivars safely
- From: Daniel Child <email@hidden>
- Date: Wed, 12 Sep 2007 21:12:18 -0400
It makes sense for it to be a singleton. It will eventually be
interfacing with a component. And there is no need for "lots of
them." The same "machine" processes streams of words one set at a
time. No need to create a new machine for each set of data. I am
simply clearing fields that store input or that store output
temporarily.
On Sep 12, 2007, at 5:48 PM, Chris Hanson wrote:
On Sep 12, 2007, at 1:59 PM, Daniel Child wrote:
I am trying to find a way to safely reset or reinitialize the
instance variables of a singleton object.
If you feel a need to do this, should it really be a singleton?
Very few objects should be singletons. Even for true singletons,
it's almost always better to make them normal, separately-
instantiable objects -- it makes writing the unit tests that
specify their behavior much, much easier -- and only have a
"default" or "shared" instance as a convenience.
-- Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden