• 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 vs. messaging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notifications vs. messaging


  • Subject: Re: Notifications vs. messaging
  • From: Georg Tuparev <email@hidden>
  • Date: Mon, 1 Oct 2001 13:41:42 +0200

Well, last time I was looking at the source of Sketch was when it was still called Draw ;-) but I think I can replay this one. It sends notifications, because it is not known if the Palette is initialized at the moment of the event. Of course one can send message to nil, but this will get messy when the palette gets loaded for the first time. It has to tell all open documents that it is now active, and in addition should also listen for other documents getting opened. With other words, big mess... It is a general design pattern, that if you have multi-document application with helper View objects (e.g. Palettes, Inspectors, etc) one should connect the Model, with all helper Views and Controllers indirectly through notifications. I still remember the pre-NSNotification days. Tones of lasagne code was written...

gt

On Monday, October 1, 2001, at 04:15 AM, Brian Hook wrote:

That seems like a good rule. However, Sketch sets up a notification for when the tool palette changes. I'm curious why the sample code doesn't just have messages being sent directly -- is it because they don't know many documents might exist and thus registering all documents with the tool palette would be ugly?

Georg Tuparev
Tuparev Technologies
Klipper 13
1186 VR Amstelveen
The Netherlands
Mobile: +31-6-55798196


  • Prev by Date: Re: How to determine a single pixels alpha?
  • Next by Date: Re: NSScrollView and general IB annoyance
  • Previous by thread: Re: Notifications vs. messaging
  • Next by thread: Re: Notifications vs. messaging
  • Index(es):
    • Date
    • Thread