title: Factory design pattern location of switch statements
body: <p>I am trying to wrap my head around the usefulness of the factory design pattern.</p>
  
  <p>Like many implementations of this design pattern (ie <a href="http://msdn.microsoft.com/en-us/library/ee817667.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee817667.aspx</a>) there is a switch statement in Main() that probes a string to decide which ConcreteComputerFactory to create (which is later sent to a ComputerAssembler.Assemble(ComputerFactory factory) method).</p>
  
  <p>The way I see the problem: 
  1. the user of the factory (Main()) "knows" the concrete factory implementations which by the very definition of the design pattern is supposed to be hidden from.
  2. whenever a new concreteComputerFactory is introduced, the abstraction doesn't hold grounds! we have to go to the client (Main()) to add another if/case statement.</p>
  
  <p>Proposition:
  Move the if/switch statement/s to ComputerAssembler. (this has a slight problem that now ComputerAssembler has 2 reasons to change: a. overall stuff related to the creation b. adding a new ConcreteComputerFactory. but: this is certainly much better than in the client (Main))</p>
  
  <p>I assume that I just don't fully grasp the idea yet. I would like to hear from you why the problems I specified are incorrect, and why my proposition isn't a better idea</p>
  
  <p>Thanks :)</p>