Watch the Ali Ozer video from the other day at wwdc. 
He covers this very topic. 

Sent from my iPhone

> On Jun 16, 2016, at 8:34 AM, Graham Cox <graham....@bigpond.com> wrote:
> 
> 
>> On 16 Jun 2016, at 3:45 AM, Jens Alfke <j...@mooseyard.com> wrote:
>> 
>> 
>>> On Jun 14, 2016, at 4:48 PM, Graham Cox <graham....@bigpond.com> wrote:
>>> 
>>> @property (readonly) BOOL isFoo;
>>> 
>>> or:
>>> 
>>> @property (readonly, getter=isFoo) BOOL    foo;
>> 
>> Are you asking whether it’s better to name a boolean property “foo” or 
>> “isFoo”?
> 
> 
> Yes, but for readonly properties only, where there is no setter.
> 
> If the property is ‘isFoo’, then in every situation (such as KVO, or using 
> dot syntax) I would be using the keypath “isFoo”, and that’s fine, but it’s 
> inconsistent with other properties that are not readonly, where the 
> underlying property is ‘foo’, but in some code I’d use ‘isFoo’ and other 
> times I’d just use ‘foo’. However, if I try and make that consistent, by 
> having the property ‘foo’ and a custom getter ‘isFoo’, then for a readonly 
> property it seems a bit redundant.
> 
> I suppose what I’m really asking is what requires the least parsing by a 
> developer - if I have a mix of styles, then I’m going to have to check every 
> one to see whether there’s a custom getter or not. Better would be to stick 
> to one style or the other, so that given a BOOL property, I know immediately 
> how to use it without further ado. To that end, I think the second form is 
> the most consistent, at the expense of some redundancy, but perhaps just 
> naming BOOL properties ‘isXXX’ sidesteps that question altogether, even for 
> readwrite properties. I can’t decide what is best practice, hence I asked the 
> question to see what others’ opinions are.
> 
> 
> ―Graham
> 
> 
> 
> _______________________________________________
> 
> 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/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com

_______________________________________________

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