Re: Looking at self = [super init].
Re: Looking at self = [super init].
- Subject: Re: Looking at self = [super init].
- From: Dave <email@hidden>
- Date: Tue, 02 Jun 2015 20:51:08 +0100
> On 2 Jun 2015, at 11:02, Jeremy Pereira <email@hidden> wrote:
>
>
>> On 1 Jun 2015, at 19:11, Dave <email@hidden> 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 (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