On Mar 8, 2012, at 2:18 PM, CoGe - Tamas Nagy wrote:

> I should subclass NSMutableArray because I had a project which used 
> NSMutableArray (calls) before, but was not thread safe. Anyway, I can't 
> really understand why it would be _really_ better to implement just 
> accessors, but maybe you could explain it a bit more?

Same reason you wouldn’t implement a “name” property as a NSMutableString — 
encapsulation, an important concept in object-oriented programming. Your object 
should be the only object that directly manipulates its internal data. You end 
up with a much more flexible design this way, for a lot of the reasons I 
already mentioned.

Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to