Dependency Injection leads to proliferation of factories?

There's nothing wrong with a class that instantiates many other objects. Instead, that class should be treated as an aggregate root domain entity. As for different "types" of entity, if you assume they implement the same interface or inherit from the same base class, then passing a type argument to Factory.

Create(type) is how I usually go about approaching this issue. The internals of create() may delegate to other classes ala the Strategy pattern, but the client facing API is straightforward.

I've been a fan of constructor injection for as long as I've known about DI, because to my mind that's what a constructor is for. It states "I need instances of the following classes/interfaces in order to do my job" - e.g. Pass me a File and an PrintWriter and I'll write the contents of the former to the latter.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions