• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: resetting ivars safely
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: resetting ivars safely
      • From: Uli Kusterer <email@hidden>
References: 
 >resetting ivars safely (From: Daniel Child <email@hidden>)
 >Re: resetting ivars safely (From: Chris Hanson <email@hidden>)

  • Prev by Date: Drop bug in NSTableView?
  • Next by Date: Re: resetting ivars safely
  • Previous by thread: Re: resetting ivars safely
  • Next by thread: Re: resetting ivars safely
  • Index(es):
    • Date
    • Thread