> On 2 Jun 2015, at 11:02, Jeremy Pereira <jeremy.j.pere...@googlemail.com> 
> wrote:
> 
> 
>> On 1 Jun 2015, at 19:11, Dave <d...@looktowindward.com> wrote:
>> 
>> 
>> Exactly, so make it more readable, to me anyway, unnecessary braces just add 
>> to complexity or at least makes the method look more complex than it 
>> actually is. 
> 
> Noooooooo!
> 
> Complexity is not about how many braces there are and how much indentation 
> there is.  Complexity is about the number of different execution paths and 
> states.

I said it makes it “look” more complex, not that it made it more complex, which 
may or not be the same thing.

> There is also the problem of maintainability.  What if you want to add a line 
> of code?

>  If you want to add it before the execution of "lots of code", no problem in 
> either case.  If you want to add it after the execution of "lots of code", 
> again no problem if you only want to execute it only if foo is true.

Well Obviously then you do:

if (X == YES)
        {
        }
else
        {
        }

As far as maintainability is concerned, I find less braces more maintainable.

There are always cases when you can’t do an early return, in those cases of 
course you need to add braces, but if possible I always use an early return.

Cheers
Dave


_______________________________________________

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