Re: Notifications vs. messaging
Re: Notifications vs. messaging
- Subject: Re: Notifications vs. messaging
- From: Chris Hanson <email@hidden>
- Date: Mon, 1 Oct 2001 18:36:07 -0500
At 7:15 PM -0700 9/30/01, 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?
The key word above is "registering." This, to me, indicates that
you're building a loosely-coupled system. While Objective-C is
pretty loosely coupled to begin with, some things probably shouldn't
even have as much knowledge about each other as the sender of a
message has about its receiver.
Thus notifications are essentially an implementation of the
"observer" design pattern.
-- Chris