@properties and Information Hiding
@properties and Information Hiding
- Subject: @properties and Information Hiding
- From: Karl Goiser <email@hidden>
- Date: Fri, 2 Nov 2007 00:07:33 +1100
Hello,
It was interesting to read how the new @properties feature of
Objective-C 2.0 are justified in terms of encapsulation. Of course,
one of the other major principles of object-oriented programming is
information hiding, that is, only exposing (making public) the parts
of an object which are necessary for interaction with it. At first
look, it seems that properties make it much easier to break this
principle. (Note that I am not saying that it does break it, just
that it makes it easier to.)
Along these lines, I am looking for advise on how to implement a
pattern that I am sure many people use: having a private setter and a
public getter. Before properties, I'd implement the two methods in
the implementation part and only declare the getter in the interface
part. But now, in the 2.0 world, how can I leverage the magic of
synthesis to implement such a pattern?
Thanks in advance!
Karl
_______________________________________________
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