Re: Bindings between nib files (again)
Re: Bindings between nib files (again)
- Subject: Re: Bindings between nib files (again)
- From: Keary Suska <email@hidden>
- Date: Thu, 30 Nov 2006 22:10:29 -0700
- Thread-topic: Bindings between nib files (again)
on 11/30/06 6:28 PM, email@hidden purportedly said:
> Bindings should usually be between objects within a model or between
> model objects and view objects.
Actually, the pattern employed is Model-View-Controller, so bindings should
be between models and controllers or between views and controllers. This
facilitates the separation of the presentation layer from the data layer. In
reality, bindings are just a technology to facilitate near-automatic
dependent relationships between any two objects. It is entirely sensible to
have bindings between views, or as in your example, between models. For
example, the enabled state of a button could be bound to the state of a
checkbox. To introduce a model object into this mix could possibly violate
the MVC pattern rule.
> Models can be created in nib files, but they usually aren't. The
> question about how to make bindings between nibs never comes up
> because bindings are made from one nib to some model objects.
> Different bindings are made in other nibs to the same or different
> model objects.
Again, the binding is to a controller object, and it is entirely possible
that a needed controller is in a different nib (or even a model instantiated
in a different nib). If you never have any model objects instantiated in a
nib, or instantiated by an object instantiated in a nib, you will either end
up having to set all of your bindings programmatically (and isn't the point
of bindings using less code?) or you will have to proxy all bindings from
the nib through a the files owner and that becomes rather cumbersome with
projects of even moderate complexity.
> The information that is being displayed or edited by the views in a
> nib should be stored in the model objects and therefore accessible
> from any/all nibs.
I am not sure where you get this. There is nothing inherent in Objective-C,
Cocoa, or the "model" pattern that automatically allows or requires a model
object to be accessible by any nib. In fact, the only thing that defines a
pure model object is that it has data and behavior with no representational
functionality. And a nib only has access to models that it has been
specifically given access to. Outside of this, a nib has no accessibility to
any model object whatsoever, regardless of how or where it is instantiated.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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