title: What is a real-life example of detrimental code explosion caused by field initializations?
body: <p>In <em>CLR via C#</em>, Richter notes that initializing fields in a class declaration, like so</p>
  
  <pre><code>class C {
    int x = 3;
    int y = 4;
  
    public C() { ... }
    public C(int z) { ... }
  
    ...
  }
  </code></pre>
  
  <p>results in inserting statements at the beginning of each constructor that set the fields to the provided values.  As such, the line <code>int x = 3;</code> above will be responsible for two separate initializations -- one in the parameterless constructor and one in the constructor that takes an <code>int</code> argument.</p>
  
  <p>Richter goes on to say:</p>
  
  <blockquote>
    <p>This means that you should be aware of code explosion [...] If you have several initialized instance fields and a lot of overloaded constructor methods, you should consider defining the fields without the initialization, creating a single constructor that performs the common initialization, and having each constructor explicitly call the common initialization constructor. This approach will reduce the size of the generated code.</p>
  </blockquote>
  
  <p>I'm having trouble envisioning a scenario in which this would become a noticeable issue, which makes me wonder if I'm missing something here.  For instance, if we imagine that our class has ten constructors and a hundred fields and it takes, say, sixteen bytes of native machine code to perform an initialization then we're talking about a total of 16 kB of generated native code.  Surely that's a negligible amount of memory on any computer from this century, right?</p>
  
  <p>I imagine using generics could multiply that by a small factor, but still the impact on the working set seems quite small.</p>
  
  <p><strong>Question:</strong> Am I missing something here, and, if so, what?</p>
  
  <p>While my question is mainly theoretical -- I want to test my own understanding -- it's also a bit practical, as initializing the fields where they're declared seems to produce substantially more readable code than using a centralized constructor like Richter suggests.</p>