![](/static/66c60d9f/assets/icons/icon-96x96.png)
![](https://lemmy.world/pictrs/image/0d5e3a0e-e79d-4062-a7bc-ccc1e7baacf1.png)
I totally agree with you that a typical CEO would not put up with this at all, but then I don’t think this is a very typical situation :D I would assume she knew what she was getting into. He named himself CTO so it’s not like he’s no longer involved in the company, and the CEO can’t really ‘overrule’ him on any product decisions or anything else since he’s technically also her boss.
Now, if he’s smart he will hopefully at least take her opinions/guidance into consideration, but 🤷
Generally speaking the use case is writing tests. If your tests just call all the dependencies and
new
directly then it’s harder to write tests for your specific component while avoiding setting up a whole bunch of stuff (to make all those other classes work). By requiring all the dependencies to be provided to the class, you can swap them out at test time for something else that’s easier to work with.That said, IMO it’s a symptom of problems in language design. Using DI is only necessary because languages like C# don’t make it easy to mock out
new
or classes used directly, so we resort to wrapping everything in interfaces and factories to avoid those features and replace them with ones that are easier to mock. If the language was designed such that those features were easy to replace during testing then DI probably wouldn’t be a thing.