On May 27, 2008, at 02:11, Hamish Allan wrote:

Perhaps "Nib's Delegate" would fit better with people's understanding?

The counter-argument would be that "delegate" isn't the right word either, given that it has a specific meaning in Cocoa, and this isn't a delegate in that sense.

Thinking about the conceptual issue again, it occurred to me that a word like "owner" (and "delegate", I think) may suggest -- to someone trying to come to grips with the concept -- that File's Owner must have some *behavior* that qualifies it to be an owner, whereas there are no behavioral requirements at all. To be qualified to be used as File's Owner, all an object needs is some outlets to connect into the nib object graph and/or some observable properties that objects in the nib can bind to.

For example, as I said before, you can use a NSDocument subclass as File's Owner of a window nib file, but it's the document's NSWindowController (afaik in this case) that has the behavior that loads the nib and manages the lifetime of the objects in the nib. The NSDocument has no knowledge of the nib (again, afaik) -- beyond its blind passing of the nib name to its window controller.

So I was wondering if something like "Nib's Root Object" might work better. I think, to anyone with even a small amount of exposure to programming topics, "root" connotes something structural and not something behavioral, which seems appropriate here.



On May 27, 2008, at 07:06, Andy Lee wrote:

You would send the message to the object you want to be the File's Owner.

Instead of:

  BOOL didLoad = [NSBundle loadNibNamed:@"MyNib" owner:myObject];

...you would say:

  BOOL didLoad = [myObject loadNibNamed:@"MyNib"];

...thus leaving out any mention of bundles as an implementation detail. It would then be correct to say that the File's Owner would be the object that loaded the nib.

Aside from functional issues, I'm not sure this helps greatly on the conceptual front. It may just shift the question from "Which object do I specify for 'owner:'?" to "Which object do I send the message to?" I guess you'd have to test it in the field to find out. :)


_______________________________________________

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