Re: Another controversial question
Re: Another controversial question
- Subject: Re: Another controversial question
- From: Drew McCormack <email@hidden>
- Date: Sun, 2 Sep 2001 13:33:11 -0700
Thanks to all who responded. I think I get it fully now.
I hadn't realized that key-value coding would actually call the accessor
method if it were present. This changes things dramatically. It actually
isn't really a serious violation of encapsulation, just a means of
automatically writing accessor methods. If all an accessor needs to do
is directly return an attribute, key-value coding can take care of it.
If the required behaviour is more elaborate, an accessor can always be
written, and that will be called. Importantly, an accessor method can
always be added later if the implementation is to be changed, and the
rest of the code will be unaffected. This last point is what
distinguishes direct access of member attributes from key-value coding.
Pretty cool actually. Thanks again.
Drew McCormack