title: Design pattern flexibility issue Factory Method
body: <p>I've been having a recent discussion with a colleague regarding the Factory Method design pattern.
  One basic approach is that the static method (from the factory class for example )should hide the complex creation logic of the created class:</p>
  
  <pre><code>class IObject {
      //Interface
  };
  
  class A :public IObject {
  
  };
  
  
  class Factory {
      static IObject * create(int type) {
          //All logic goes here
      }
  };
  </code></pre>
  
  <p>The issue is that in our case the factory class will <strong>always</strong> only return an explicit object of type A.
  My honest opinion was the the int argument of the static factory method is useless and ads unnecessary complexity.</p>
  
  <p>Also returning an Interface pointer of type IObject is also forced in my opinion. There is no need to return a pointer of base class if there is and <strong>always will be</strong> only ONE implementation. 
   I think things can be simplified :</p>
  
  <pre><code>class A {
  };
  
  
  class Factory {
      static A createA() {
          //All logic goes here
      }
  };
  </code></pre>
  
  <ul>
  <li>My college is arguing that design patterns need to be applied
  literally and that maybe in the future things will change thus using
  he's version will simplify things down the road(because the code is
  more flexible).</li>
  <li>I'm adept more to the <a href="https://en.wikipedia.org/wiki/KISS_principle" rel="nofollow noreferrer">KISS</a> principal and honesty making code flexible
  for a feature that might not even exist might invite problems down
  the road.</li>
  </ul>
  
  <p>As far as what GOF has to say:</p>
  
  <blockquote>
    <p>The design patterns in this book are descriptions of communicating
    objects and classes that are customized to solve a general design
    problem in a particular context.</p>
  </blockquote>
  
  <p>The answer seems to indicate that design patterns are more a <strong>description</strong> on how to solve some things and not a <strong>prescription</strong>. </p>
  
  <p>So what do you guys think (for this particular case)?</p>