Re: Accessing array in thread safe way
Re: Accessing array in thread safe way
- Subject: Re: Accessing array in thread safe way
- From: CoGe - Tamas Nagy <email@hidden>
- Date: Thu, 08 Mar 2012 21:36:33 +0100
Thanks for the explanation, you are absolutely right!
Tamas
On Mar 8, 2012, at 9:32 PM, Charles Srstka wrote:
> 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 (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