title: "Singleton" factories, ok or bad?
body: <p>I've a lot of (abstract) factories and they're usually implemented as singletons. </p>
  
  <p>Usually for the convenience of not having to pass them through layers who really have no business with using or knowing these factories.</p>
  
  <p>Most of the times I only need to make a decision at startup of which factory implementation the rest of the code program, maybe through some configuration </p>
  
  <p>it looks e.g. like</p>
  
  <pre><code>abstract class ColumnCalculationFactory { 
    private static ColumnCalculationFactory factory;
  
   public static void SetFactory(ColumnCalculationFactory f) {
           factory = f;
    }
  
    public static void Factory() {
           return factory;
    }
  
   public IPercentCalculation CreatePercentCalculation();
   public IAverageCalculation CreateAverageCalculation();
      ....
  
  }
  </code></pre>
  
  <p>Someting do smell about this, I'm just not sure what - it's maybe more a disuised global than a singleton. It's not like there really really <em>have to</em> be only one factory ever creating ColumnCalculations - although my programs don't need more.</p>
  
  <p>Is this considered best practuce ? Should I rather stuff these in some (semi) global AppContext class ? Something else(I'm not quite ready to switch to some larger IoC container, or spring.net quite yet btw) ?</p>