title: Good practice to instantiate classes from an enum value
body: <p>I've been searching to many places but I didn't find a good answer for my problem:</p>
  
  <p>I have an enum, for example:</p>
  
  <pre><code>public enum Window { CLASSIC, MODERN }
  </code></pre>
  
  <p>and I need to separate the behavior of my application according to the enum value, like that:</p>
  
  <pre><code>switch (myWindow.getType()) {
    case CLASSIC: new ClassicWindow(...);
    case MODERN: new ModernWindow(...);
  }
  </code></pre>
  
  <p>I know what you think: simply put that in the enum and basta, however this is not the only class depending on my enum! And I can't write as many object creation methods as I have objects!</p>
  
  <p>Simply put, what can I do in this situation? A friend of mine said to me to get rid of the enum and to use derived classes everytime, but in the end I'd have to create as many instances as subclasses for all my tests!</p>
  
  <p>In short, I'm stuck.</p>
  
  <p>Do you know a best practice for that? Thanks</p>