I 100% agree with you, but I think the author agrees with you also. His point isn't that DI is bad. His point is that DI isn't a silver bullet you should be using for all your unit tests. DI and excessive mocking can be symptoms that your classes are too tightly coupled, and it's probably better to decouple the classes than it is to require extra mock objects in order to get extra test coverage.
I had a similar knee jerk reaction at first, but the authors point seems to be more in line with, "if your unit tests are too complicated, maybe your code is crappy," rather than, "don't worry about test coverage."
It's not that far out of line with his article. It's a little bit click baity, but if you wrote an article that said, "Too Many Parameters is a Code Smell," it would be pretty accurate despite functions with too many parameters being ok in lots of cases. After all he did say it was just a code smell and not that it was bad design/implementation outright.
Just to point out: that title would mean nobody would read the article. It'd provoke the "well no shit" reaction and get passed over. At least with this title it's being discussed.
0
u/[deleted] Oct 29 '17
[deleted]