I am a big fan of DI/IOC. It is great for handling/abstracting away hard dependencies, and makes life a little easier.
However I have a small gripe with it, which I am not sure how to solve.
The basic idea in DI/IOC is that when an object is instantiated, all of its dependencies are pre-filled within the constructor.
However IMHO there are several types of parameters for constructors (especially when your objects are immutable).
- Dependencies (Objects required for your object to do work)
- Configuration (information about the environment required to do work)
- Parameters (Data that work is done on)
I find that IOC works well with dependencies. But I am still trying to work out the best way to deal with the other two. However, since the constructor is run meant to be run by the IOC container, it seems I need to place these items into the IOC container.
I'd like to know what strategies/patterns people employ and what advantages and disadvantages people have found.
NB. I am aware this is a highly subjective question, and have tried to make it a "good" subjective question as per SE guidelines.