title: Difference between an instance of a class and a class representing an instance already?
body: <p>I use Java as an example but this is more of a general OOP design related question.</p>
  
  <p>Lets take the <code>IOException</code>s in Java as an example. Why is there a class <code>FileNotFoundException</code> for example? Should not that be an instance of a <code>IOException</code> where the <strong>cause</strong> is <code>FileNotFound</code>? I would say <code>FileNotFoundException</code> is an instance of <code>IOException</code>. Where does this end? <code>FileNotFoundButOnlyCheckedOnceException</code>, <code>FileNotFoundNoMatterHowHardITriedException</code>..?</p>
  
  <p>I have also seen code in projects I worked in where classes such as <code>FirstLineReader</code> and <code>LastLineReader</code> existed. To me, such classes actually represent instances, but I see such design in many places. Look at the Spring Framework source code for example, it comes with hundreds of such classes, where every time I see one I see an instance instead of a blueprint. Are not classes meant to be blueprints? </p>
  
  <p>What I am trying to ask is, how does one make the decision between these 2 very simple options:</p>
  
  <p>Option 1:</p>
  
  <pre><code>enum DogBreed {
      Bulldog, Poodle;
  }
  
  class Dog {
      DogBreed dogBreed;
      public Dog(DogBreed dogBreed) {
          this.dogBreed = dogBreed;
      }
  }
  </code></pre>
  
  <p>Option 2:</p>
  
  <pre><code>class Dog {}
  
  class Bulldog extends Dog {
  }
  
  class Poodle extends Dog {
  }
  </code></pre>
  
  <p>The first option gives the caller the requirement to configure the instance it is creating. In the second option, the class represents the instance itself already (as I see it, which might be totally wrong ..). </p>
  
  <p>If you agree that these classes represent instances instead of blueprints, would you say it is a good practice to create classes that represents instances or is it totally wrong the way I am looking at this and my statement <em>"classes representing instances"</em> is just load of nonsense?</p>