Re: Is encapsulation deprecated in ObjC?
Re: Is encapsulation deprecated in ObjC?
- Subject: Re: Is encapsulation deprecated in ObjC?
- From: Chris Gehlker <email@hidden>
- Date: Fri, 17 Aug 2001 12:41:01 -0700
On 8/16/01 11:51 AM, "Charles Jolley" <email@hidden> wrote:
>
BTW, I remember reading some old documentation several years ago stating
>
that one should create accessor methods for all ivars subclasses might
>
want to access to help limit the "fragile base class problem." If you
>
change the implementation of your class in such a way that a given ivar
>
is no longer used, you can still provide accessors for that ivar that
>
calculate the value by some other means. Thus, subclasses will "just
>
work" without having to be modified.
OK, there is at least some rationale for creating public accessors for
everything. Thanks for explaining that. I wish learning Cocoa would take a
few paragraphs to explain the reasoning behind this and some of the other
rules that they present in a "do this" fashion.
I have to say that I don't find this reasoning very compelling. If I don't
need an accessor in a base class, the chances are slim that I'll need it in
a descendant of that class. If I do, it's probably time to rethink my
design.
--
In the midst of great joy, do not promise anyone anything. In the midst of
great anger, do not answer anyone's letter. -Chinese proverb