title: Initialization Pattern?
body: <p>Say I have class A:</p>
  
  <pre><code>public class A
  {
    private B _b;
  
    public class A(B b)
    {
      Assert.That(b != null);
      _b = b;
    }
  }
  </code></pre>
  
  <p>And object b needs some complex initialization, like:</p>
  
  <pre><code>b.Prop1 = ...
  b.Prop2 = ...
  b.Prop3 = ...
  
  int answerToSomeComplexFormula = PerformComplexFormula();
  
  b.Prop4 = answerToSomeCopmlexFormula
  
  etc...
  </code></pre>
  
  <p>I do not want to perform this initialization in the constructor.  Is there a name for some pattern that describes returning an object that has complex initialization?  Something like:</p>
  
  <pre><code>public class BInitializer
  {
     public B Create()
     {
        B b = new B();
        // set up properties
        return b;
     }
  }
  
  BInitializer initializer = new BInitializer();
  B b = initializer.Create();
  
  A a = new A(b)
  </code></pre>
  
  <p>Thanks!</p>