notifications vs delegates (was: The fuzzy aspects of Cocoa)
notifications vs delegates (was: The fuzzy aspects of Cocoa)
- Subject: notifications vs delegates (was: The fuzzy aspects of Cocoa)
- From: Jay Kuri <email@hidden>
- Date: Tue, 26 Feb 2002 19:03:23 -0600
Your specific question about notifications vs. delegates is answered
in a
Stepwise article:
http://www.stepwise.com/Articles/Technical/2000-03-03.01.html
I read this and another at cocoadevcentral and I have a question.
The stepwise article implies that notifications are slower than a
delegates... (relating to looking up in a hash table vs just using the
selector) my question here is: how much slower are they? does it
really make enough of a difference to choose one over the other in
'normal' situations?
The one thing I didn't notice is when to use one over the other if you
are not looking for possible veto (close window example). Suppose you
have an object (part of a framework) that wants to deliver a small chunk
of data to an interested object. Normally, this data would only be of
interest to a single object... is there a reason to choose delegates
over notifications or vice versa?
From what I gather, notifications are a bit more flexible in terms of
dynamic messages (notifications with names that are defined at run time)
but delegates are faster...
Is there a way that is more 'correct' in terms of the purposes that each
are intended/designed for?
The new book
http://www.amazon.com/exec/obidos/ASIN/0672322307/qid=1007334922/ref=sr%
5F11_0_1/104-7088896-0467148
has a lot of that type of information.
I'll keep an eye out for that one in the bookstores... Thanks for
the heads up.
Jay
----- Original Message -----
From: "Jay Kuri" <email@hidden>
To: <email@hidden>
Sent: Tuesday, February 26, 2002 12:51 PM
Subject: The fuzzy aspects of Cocoa -or- C-programs crammed into
objective-C
jackets
Hi there,
I have a question for all you seasoned cocoa programmers out there...
Are there any good guides to the more fuzzy aspects of programming
Cocoa? What I mean is that there are plenty of intro's to how to use
Cocoa, what you can do... etc... But what I'm missing is the why...
What are the common practices... Often you can accomplish the same
thing
with a notification as a delegate object but when is the right time to
use a notification vs. a delegate... or, as another person recently
posted, why use exceptions rather than return codes... ?
It's easy to write a program that works... I want to know if anyone has
tips / a guide on how to write elegant programs in cocoa... How to
write
cocoa apps in a characteristically cocoa way... and not in a C-program
crammed into an objective-C mold type of way.
I'd love to hear any thoughts, tips, links... etc...
Jay
_______________________________________________
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.