> in some cases, the set up within the parens could get pretty long. In cases > like that, I generally set up another method to handle that for organization, > but if you're passing objects into into your init method, then you're passing > more data again and the code could get less cleaner looking than it could be. > > So, I thought, "why don't we check if self != [super init] and then > immediately return if that is the case?”
Totally agree, I always do it like this: -(instanceType) init { self = [super init]; if (self == nil) return nil; // Init code here return self; } I nearly prefer a fast return over using a Brace, for instance: -(BOOL) someMethodWithParameter1:(NSString*) theParam1 andParam2:(NSString*) theParam2 { if (theParam1 == nil) return NO; if (theParam2 == nil) return NO; // Other code here return YES; } In preference to: -(BOOL) someMethodWithParameter1:(NSString*) theParam1 andParam2:(NSString*) theParam2 {if (theParam1 != nil) { if (theParam2 != nil) { // Other code here } return YES; } return NO; } All the Best 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