39

Some developers get over-excited about using dependency injection and make further maintenance a nightmare.

Comments
  • 4
    Ugh. Tell me about it.
  • 2
    I never understood what's good about DI? My lead programmer used to insist that we have to do DI. -_-
    It was a nightmare for me when I started to learn it.
  • 1
    I like it in only one case, when using Asp.Net Core, UserManager & LoginManager are injected after initialized by the system, no need for me to interfere other than that I don't like it.
  • 3
    @aldoblack
    Actually DI can be very usefull, e.g. if you abstract the objects behind protocols. Than you can inject any object that implements this protocol into your class. This allows you to change specific implementations quite easily and reduces coupling between components. Also you can inject mocks for testing.
  • 1
    Problem is when developers forget they are working in real life projects, maintaned by real people, but think they are still working on their Master's thesis.
Add Comment