The magic of Key Value Coding and Key Value Observing
The magic of Key Value Coding and Key Value Observing
- Subject: The magic of Key Value Coding and Key Value Observing
- From: Erik Buck <email@hidden>
- Date: Thu, 30 Aug 2007 21:29:28 -0700 (PDT)
Key Value Coding and Key Value Observing seem just a
little too magical to me, and I think I understand how
it all works. I have been using these techniques for
a year now, and I find myself using them less and
less.
The underlying implementation of Key Value Observing
uses "isa swizzling". This is a clever trick enabled
by the Objective-C runtime.
Key Value Coding uses Objective-C runtime
introspection to access instance variables and expands
on the approach previously/also used to connect
outlets when loading nib files.
There is no doubt that KVO and KVC are cleaver. They
can be used well for rapid application prototyping.
They can eliminate many lines of code, and they
support the larger concepts of "bindings." They just
aren't obvious. Like connections made in Interface
Builder, there is no intention revealing source code
that communicates the implementation to other/future
programmers. I obviously use connections in Interface
Builder, and I firmly believe that less code is
better. I just can't articulate why I am
uncomfortable with KVC and KVO when I am comfortable
with connections in IB.
I look forward to language support for "properties."
and hope that they will communicate intention in a way
that I think is missing from current KVC and KVO.
_______________________________________________
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