>> Notifications is another point of confusion for me. I would assume
>> that notifications should be used when multiple observers can be
>> connected to an "event" exposed by an object, in contrast to a simple
>> "delegate" outlet, which can only have one connected object. Am I
>> correct?
>
> They're really for two different things.  Often a delegate interface
> supports a superset of what notifications will notify observers of; for
> example, see the descriptions of the delegates for NSWindow and
> NSApplication, and compare them with those classes' notifications.

Yes, I see that delegate methods and notifications do overlap a lot.
What is this your example supposed to mean? Is my understanding of
notifications vs delegates correct or not?

>> What I am actually trying to do is to build a custom editor view that
>> would notify it's parent window when the state of the view changes,
>> e.g. due to user actions. I think delegate is the right choice,
>> correct?
>
> Should it really tell its window about user input?  Or should it tell a
> controller about that user input, and let the controller manage the rest of
> the reaction to that input?
>
> The latter is often the design approach taken in Cocoa.  A control or view
> will take care of turning the press of a key, the click of a mouse, or some
> other user action into a higher-level action that's sent to a controller.
>  It's the controller that does something meaningful to the application with
> that action.

Yes, I mean it tells the window controller, not the window itself of
course. Sorry, I am not quite fluent in the terminology yet.

By the way, what is the best practice of implementing delegates -
should these be separate objects or the window controller should be
the delegate? The latter approach yields fewer classes and fewer
relations between classes but, I am afraid, delegate methods from
different views in a single window controller may overlap and also
delegate message names, while meaningful in the sender views, may not
be as meaningful in the window controller, because it is an object one
level up in the view hierarchy.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to