I understand the concept and can use both the Factory Pattern and Dependency Injection, however they seem a little at odds with each other conceptually. Is it a case of using one over the other? Or can they be used in conjunction with each other?
If using DI would you hard code the creation of classes within a Factory? Wouldn't this defeat the point of DI? As the factory is dependant on the existence of the classes it creates, and thus would need them passed to the factory at runtime when using DI.
Or would you pass the classes that the factory is meant to create to the factory is meant to create? If so wouldn't that defeat the point of building a factory in the first place? As the Injector would basically be doing all the work of the factory.
Thank you very much for your attention, I look forward to your insights.