• 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: Notifications or singletons?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notifications or singletons?


  • Subject: Re: Notifications or singletons?
  • From: j o a r <email@hidden>
  • Date: Mon, 7 Apr 2003 07:49:57 +0200

I think you've done the right thing. It is sometimes tricky to decide when to tie objects together with notifications and when to use stronger bonds. IMO you've made the right choice here, because when the user requests to open a new inspector window a maximum of one existing object, and a known object, is affected (0 objects if you allow for multiple inspectors (1 object if you don't allow multiple inspectors on the same record), 1 object if the inspector is shared).

As an example on when to use notifications: If you allow multiple inspector / detail windows you might consider to implement "WillDeleteRecord" / "DidDeleteRecord" notifications to use if the user deletes an inspected entry - that would allow the inspector to close it's window / update display on these events.
In this case you could still use a direct method call - if your inspector class maintained a list of inspectors that could be traversed as a response to these actions - but I would have used notifications.

j o a r

On Monday, Apr 7, 2003, at 01:12 Europe/Stockholm, Andrew Merenbach wrote:

I'm working upon a small address-book-like application that maintains a list of contacts and associated data. When a contact's name is double-clicked in the main list, a new window opens with more detailed information. I currently do this via a singleton: the detail window has a shared instance that my master list calls, with the currently-selected contact as an argument, and the contact window controller loads the contact's information. Would this be better done through notifications?
_______________________________________________
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.

References: 
 >Notifications or singletons? (From: Andrew Merenbach <email@hidden>)

  • Prev by Date: Re: Transferring large files using DO
  • Next by Date: Re: New to ObjC/Cocoa - looking to get data from OS
  • Previous by thread: Re: Notifications or singletons?
  • Next by thread: Transferring large files using DO
  • Index(es):
    • Date
    • Thread