Re: File's Owner
Re: File's Owner
- Subject: Re: File's Owner
- From: Ken Thomases <email@hidden>
- Date: Sat, 24 May 2008 21:57:15 -0500
On May 23, 2008, at 7:21 PM, Johnny Lundy wrote:
My NSArrayControllers can be bound to model objects without anything
going through File's Owner.
Really? That implies that your model is contained within the nib,
which is not how MVC is supposed to work. The nib should contain the
V (View) and possibly C (Controller) parts of MVC, but it should not
contain the M (Model). One of the points of separating Model from
View from Controller is that you can have multiple different views on
the same model. Imagine an application which represents a set of
numbers in one window in a table and in another window in a graph.
These two windows can (and probably should) be described in separate
nibs, and the model should live in neither. It should be instantiated
in code somewhere else in your application, or managed with Core Data,
etc. File's Owner would be needed to connect the views and
controllers in the nibs to the model.
Perhaps you need to review the "Model-View-Controller Design Pattern"
conceptual documentation in the Cocoa Fundamentals Guide <http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html
>.
No offense, but your queries to this list remind me of the way
children can ask "Why?" infinitely. No matter what explanation is
provided, they can reflexively ask "Why?" about that new explanation.
So, you've been told by the documentation and by the respondents here
on this list that File's Owner is useful and important. And you don't
yet see how or why. That's OK. It just hasn't been important to you
_yet_. If it bothers you, you can go about your work (as you appear
to have) without making much use of File's Owner. Eventually, you
will want or need to do something which becomes difficult or
impossible to do without using File's Owner -- and _then_ you'll know
how it is useful.
I get the impression that, although you are greatly vexed and
frustrated by not yet understanding the purpose and usefulness of
File's Owner, you are not actually putting in much effort into
figuring that out for yourself. (This is what puts me in mind of the
"Why?" game that children sometimes play. I may be wrong here, and if
I am I apologize in advance.)
For example, have you exercised your imagination to try to come up
with scenarios where it might be useful? From your more recent
emails, you actually seem to have a good grasp of what File's Owner
does. And I must assume you have a general understanding of why it is
useful for some objects to have references to other objects. So, why
is it that you can't see why it might, in some circumstances, be
useful for objects in a nib to have references to objects outside of
the nib, and vice versa? "Why?" For all the myriad reasons that
objects need references to other objects. There's no one answer.
"None of my nibs have had that requirement." So? Does that limited
empirical result prove, or even imply, that no nibs might, ever?
Have you examined any of the example programs that Apple supplies? Do
you realize that the full source for TextEdit comes with the developer
tools (/Developer/Examples/AppKit/TextEdit)? Other sample projects
with multiple nibs include BlastApp, iSpend, and Sketch. Have you
examined how those examples use their nibs, and looked to see what
connections they make to, from and through the owners of those nibs?
When you read Apple design guidelines regarding nibs, do you dismiss
them or do you consider adopting them? Of course, you don't always
have to adopt them -- they're only guidelines after all. But have you
considered how adopting them would affect the way you design your
nibs? Obviously, the features (such as File's Owner) of the framework
and the tools are often useful when you do follow the guidelines. For
example, see:
http://developer.apple.com/documentation/DeveloperTools/Conceptual/IB_UserGuide/BuildingaNibFile/chapter_4_section_7.html
http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_5.html
I suppose I should step off of my soapbox. Sorry for the lecture, but
many people have been trying to help and none of us seem to have
gotten through.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden