Add new comment

st's picture

Factories

Thank you for feedback. Yes, we can define factories at least several different ways:

  • separate factory class with static methods
  • separate factory class with non-static methods (need when additional initializations/settings are required before create an instance)
  • static method within interface class (may be a small harm when derive a new interface from this one)
  • namespace functions (simplest but minimally abstract)