This is considered typical
- (id)init {
self = [super init];
if (self) {
// <#initializations#>
}
return self;
}
but wouldn’t it be better to go with something like this which actually responds appropriately?
- (id)init {
self = [super init];
if (self) {
// <#initializations#>
} else {
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"you think your constructor is executing, but it's not"] userInfo:nil]
}
return self;
}
The corollary to this question is, “under what conditions would [super init] return nil and shouldn’t you handle that in the init method?“
One reason, why you should do, what JustSid is saying:
In object-orientated design you should always code, as if you maybe will hand your class over to another project by another developer. So you can’t assume, that a failure in initialization in his project may be as bad as it is probably in yours. Maybe this developer is you in 5 years. Imagine your hassle to fix your 200 classes, you want to reuse.