Re: Cocoa bindings and reluctance to use NSPopupButon
Re: Cocoa bindings and reluctance to use NSPopupButon
- Subject: Re: Cocoa bindings and reluctance to use NSPopupButon
- From: John Joyce <email@hidden>
- Date: Sun, 18 May 2008 21:48:32 -0500
Johnny Lundy had a difficult time using NSPopupButon along with
bindings. The struggles are archived via www.cocoabuilder.com for
posterity. Mr. Lundy recently wrote "...I am still very very hesitant
to put another NSPopUpButton on my interface, because of the complete
absence of guidance on how to implement the thing, and the many days
it took to get a single one working, and even now I have no idea why
it works..."
Having just now re-read Mr. Lundy's questions and follow-up, I don't
think he had any problem with NSPopupButton at all. That makes sense
because NSPopupButton is not particularly difficult to use. I think
Mr. Lundy's struggles were all with "bindings." Had I been inclined
to participate in the threads at the time, I would have said the
following:
1) Bindings are an ADVANCED technique that was recently introduced and
not yet completely documented. If someone tries to use bindings in a
situation where he/she doesn't already know how to write the
application without bindings, it is a mistake to use bindings.
2) Bindings exist to _reduce_ the amount of Controller code needed
when the Model View Controller pattern is used. Bindings don't
eliminate controller code and can't handle all Controller
responsibilities.
3) Bindings appear to be magic, but they are in fact just an
abstraction that enables reuse in place of commonly re-written
controller code.
4) Bindings ARE NOT A REPLACEMENT FOR ALL CONTROLLER CODE, and
bindings are often not the best technique to use.
Mr. Lundy would have been better off writing his controller code
explicitly and using the established outlet, target and action
patterns instead of bindings. Not only would he have achieved
complete control over all aspects of his application's behavior, he
would have gained insight into how, and and why bindings work or not.
I find that I hardly ever use bindings in my own applications. I am
more comfortable doing things the good old fashion way in part because
I often want very fine control over application behavior. I blame Mr.
Lundy's specific struggles on misguided insistence on using the wrong
tool for the job.
I counsel Cocoa newbies to just forget about the Bindings inspector in
Interface Builder and pretend they don't exist.
Thank you Erik!
That's what I had concluded at one point, and then felt pushed back
towards.
People often said, "you should just use bindings", but I felt I did
need to first understand how it works without bindings...
With tableViews and treeViews, I can totally see where bindings would
simplify a lot of things, but still... the bindings docs are still
tough reading.
_______________________________________________
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