What is Best practice in objective c for creating an object and setting its properties <p>Considering I have a <code>UIViewController</code> called <code>ErrorViewController</code> that I am instantiating using <code>initWithNibName</code>.</p> <p>There is a enum on this <code>ErrorViewController</code> describing its "type".</p> <p>This <code>ErrorViewController</code> has one delegate function that returns to its delegate which will respond according to the type set on the <code>ErrorViewController</code>.</p> <p>Is it better to pass all the parameters within a new <code>initWithNibName</code> function, and set private properties on the <code>ErrorViewController</code>. Like this:</p> <pre><code>ErrorViewController *errorVc = [[ErrorViewController alloc] initWithNibName:@"ErrorViewController" bundle:nil andErrorType:kErrorTypeA andDelegate:self]; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil andErrorType:(ErrorType)errorType andDelegate:(id&lt;ErrorDelegate&gt;)delegate{ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.delegate = delegate; self.errorType = errorType; } return self; } </code></pre> <p>Or is it better to instantiate the object and afterward set its public properties like this:</p> <pre><code>ErrorViewController *errorVc = [[ErrorViewController alloc] initWithNibName:@"ErrorViewController" bundle:nil]; errorVc.delegate = self; errorVc.type = kErrorTypeA. </code></pre> <p>And regarding the delegate method, is it best practice to check the type by passing a parameter, or by checking the property of the passed back Controller as follows:</p> <pre><code>- (void)ErrorPage:(ErrorViewController *)ErrorPage // check ErrorPage.errorType } </code></pre> <p>or this: ?</p> <pre><code>- (void)ErrorPage:(ErrorViewController *)ErrorPage andErrorType:(ErrorType)errorType // check errorType } </code></pre>