title: The use of [[self alloc] init] when writing factory methods
body: <p>I'm having trouble understanding the use of <code>[[self alloc] init]</code>  when writing factory methods. I understand that factory methods are convenience methods to create instances of a class, and that they do the <code>alloc</code>, <code>init</code>, and <code>autorelease</code> for you. I can see how this is formed, for example in the declaration of an <code>NSArray</code> property with the factory method <code>arrayWithArray:</code>, or <code>array</code>, etc. called on it to set it up. 
  I can obviously see how this is different to an outright (explicit) call to <code>alloc</code> and <code>init</code>.</p>
  
  <p>My issue with this is that I don't understand factory methods at a deeper level. I came across an explanation online that said instead of calling <code>alloc</code> and <code>init</code> explicitly, a class factory method could be used to basically encapsulate something like this:</p>
  
  <pre><code>+(instancetype)createWithString:(NSString *)string
  {
      return [[self alloc] initWithString:string];
  }
  </code></pre>
  
  <p>But how do <code>instancetype</code> and <code>[self alloc]</code> effectively allow for subclasses to make use of the class factory method? </p>