title: New child class or conditional read from same one?
body: <p>Lets say I've a class:</p>
  
  <pre><code>class Foo{
      datatype1 x;
      datatype2 y;
      datatype3 z;
  }
  </code></pre>
  
  <p>I want to populate:</p>
  
  <ol>
  <li><p>x if y = a</p></li>
  <li><p>z if y = b</p></li>
  </ol>
  
  <p>That is, Foo with constructor would look like:</p>
  
  <pre><code>class Foo{
      datatype1 x;
      datatype2 y;
      datatype3 z;
  
      Foo(x, y){
          // x and y are intialized
      }
      Foo(z, y){
          // z and y are intialized
      }
  }
  </code></pre>
  
  <p>y is initialized to support decision making in the future of the object i.e. depending on value y, I'll read x or z.</p>
  
  <p>Does it makes OOP's sense to extend Foo and do this:</p>
  
  <pre><code>class Bar extends Foo{
      datatype1 x;
  }
  
  class Zar extends Foo{
      datatype3 z;
  }
  </code></pre>
  
  <p>and then instantiate Bar if the condition that used to make y equal a is met and Zar if the condition that used to make y equal b is met. Which means I will use instanceof on Bar's or Zar's object to do whatever I used to do earlier after reading y.</p>
  
  <p>What I find ugly: Object of Foo will either have x intialized or z depending on y. The field left uninitialized will have default value (null or its equivalent). Its a see-saw like condition, always!</p>