Skip navigation.
 
mlRe: Delegates
FROM : I. Savant
DATE : Mon May 19 22:23:29 2008

On Mon, May 19, 2008 at 2:54 PM, Michael Vannorsdel <<email_removed>> wrote:
> There's nothing that guarantees a Cocoa delegate will act for another object
> and that the represented object won't act how it wants as well.  Sometimes a
> delegate method is just a notification something happened/happening without
> the delegate having any say on the matter or affect on the represented
> object's course of action on that matter.


  Yes, but the delegating object *always* follows this pattern:

- I'm doing something for which I can ask a delegate for assistance or
advice or in which the delegate might be interested, so ...
- If I have a delegate ...
  - If the delegate responds to this particular delegate message
  - Send the message to the delegate and *wait for it to return* (ie,
it's all within the same trip around the run loop, unlike
notifications).

  No, the delegate may not:

1 - Respond to the selector (message/method).
2 - Do anything about a "just letting you know" kind of message.
3 - Return anything but the default answer when asked a "just
wondering if I should/can".
4 - Function correctly.

  In the case of 1, no harm (as in notifications). In the case of 2-4,
the delegating object *will* wait for the delegate to complete and
return execution to. VERY UNLIKE notifications. It behaves very
differently.

> I'm just saying Cocoa delegates don't always act in dictionary form.
> I know this discussion can go round and round, but I still think reading the
> english dictionary for delegates won't tell you the whole story on Cocoa
> delegates.


  Oh come on ... semantics. The term "delegate" is exactly appropriate
for this behavior. Nothing else is more appropriate and nothing about
the 'delegate' behavior of Cocoa contradicts or lay outside the
English definition for the verb 'to delegate' except that the
dictionary refers to 'people' instead of 'objects'.

  I think that's the last I'll comment on the dictionary definition
matter; it's a silly argument. Suffice to say I was more concerned
with precision and it's vitally important to realize that delegation
has more dissimilarities than similarities with notifications.

--
I.S.

Related mailsAuthorDate
mlDelegates john darnell May 19, 18:22
mlRe: Delegates Michael Vannorsdel May 19, 18:52
mlRe: Delegates Nate Weaver May 19, 18:52
mlRe: Delegates I. Savant May 19, 18:58
mlRe: Delegates Michael Babin May 19, 18:59
mlRe: Delegates I. Savant May 19, 19:01
mlRe: Delegates Paul Sargent May 19, 19:30
mlRe: Delegates Nate Weaver May 19, 19:30
mlRe: Delegates Paul Sargent May 19, 19:35
mlRe: Delegates Michael Vannorsdel May 19, 19:37
mlRe: Delegates I. Savant May 19, 19:41
mlRe: Delegates I. Savant May 19, 19:41
mlRe: Delegates Michael Vannorsdel May 19, 20:00
mlRe: Delegates I. Savant May 19, 20:25
mlRe: Delegates I. Savant May 19, 20:31
mlRe: Delegates Andy Lee May 19, 20:52
mlRe: Delegates Michael Vannorsdel May 19, 20:54
mlRe: Delegates Jens Alfke May 19, 21:01
mlRe: Delegates Andy Lee May 19, 21:01
mlRe: Delegates Andy Lee May 19, 21:07
mlRe: Delegates I. Savant May 19, 22:23
mlRe: Delegates Michael Vannorsdel May 19, 22:42
mlRe: Delegates ben syverson May 19, 22:50
mlRE: Delegates john darnell May 19, 23:00
mlRe: Delegates Jeff LaMarche May 19, 23:04
mlRe: Delegates Mike Abdullah May 19, 23:16
mlRE: Delegates john darnell May 20, 15:58