Init for the nervous


#1

I was at the BNR in 2009. Aaron was teaching that doing something like this was unnecessary:

[code]self = [super init];

if (self)
//things;

return self;[/code]

Specifically the IF statement, because “super init never doesn’t work”. I have in my class notes it was literally called “init for the nervous”. So is there some change of philosophy on this in whole or for iOS? To date I have never used If (self)… in my desktop apps.


#2

The language has changed since then and it is now required to do self = [super init] with ARC. The self check is typically superfluous, but we do it anyway.