I was watching “InfoQ: Mock Roles Not Object States” with Nat Pryce and Steve Freeman yesterday. I had read the paper previous to watching the video, and I pretty much expected the same content but in a different form. Boy was I wrong..
In particular, they talked a few minutes on an argument against Dependency Injection (DI), namely that the constructor gets lots and lots of arguments. I used DI the first time a couple of weeks ago, so I’m pretty new to it, and I wasn’t sure I was doing exactly the right thing. And, yes, the constructors at some places became huge.
What the InfoQ presentation thought me was that not all interfaces a class use are dependencies per se. Classes can for example be equipped with default parts or policies, that can be changed after creation. The important thing is that the instance will work anyway, which is not the case if an instance is missing out a dependency.
This nice picture (screenshot from their slides) made it click for me: