Gustavo Cruz
Gustavo Cruz
CC#
Created by Gustavo Cruz on 7/16/2024 in #help
Overkill on the use of interfaces for Dependency Injection in Web APIs?
I'm developing a Web API that uses Controllers, Services and DAO classes, and every single controller consumes a corresponding service through Dependency Injection. Reading about Dependency Inversion on modern-web-apps-azure I've come to realize that I'm not leveraging the benefits of the principle, i.e., to be able to use multiple implementations based on a single interface. I'm building interfaces just to make use of Dependency Injection. The current state of my API is 1:1:1 (one controller to one service to one DAO). It's overkill to use interfaces in this case? It's actually quite annoying to change services implementation details and have to update my interfaces, as well as the possible performance implications of using Injection for every service.
15 replies