• 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: Is it 'wrong' to use a global dictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it 'wrong' to use a global dictionary?


  • Subject: Re: Is it 'wrong' to use a global dictionary?
  • From: Oscar Morales Vivó <email@hidden>
  • Date: Wed, 12 Mar 2003 13:22:37 +0100

Global variables can be easily abused, but are not inherently evil. If that's the best way of doing it (and from what little you say it looks like it), go ahead.

Only advice would be to hide it as much as possible. Use a variable declared in the .m file and access it from '+' functions in a class you define. That way you become independent from its implementation which is a Good Thing.

On Wednesday, Mar 12, 2003, at 13:07 Europe/Madrid, Jason Galarneau wrote:

I'm making an app that stores its data (1000's of instances of a custom object) in a dictionary, and would like to be able to access that data from any bit of my program (i.e. from within the code of any of my controlling objects)

Is it bad form to use a global dictionary for such a purpose? What is the 'established' way to do such a thing in Cocoa? _______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • NSMenu and menu handle
      • From: James Gregurich <email@hidden>
References: 
 >Is it 'wrong' to use a global dictionary? (From: Jason Galarneau <email@hidden>)

  • Prev by Date: Is it 'wrong' to use a global dictionary?
  • Next by Date: Re: FSSpec --> OSX Path NSString
  • Previous by thread: Is it 'wrong' to use a global dictionary?
  • Next by thread: NSMenu and menu handle
  • Index(es):
    • Date
    • Thread