loading...

re: Death by Interfaces? VIEW POST

FULL DISCUSSION
 

If we're misusing interfaces - which we are - the questions are how should we use them, how are we using them incorrectly, and perhaps when are we using them without needing them?

Death by.... We're doing more harm than good with ... We can fill in the blanks with pretty much anything.

The underlying problem I see behind the abuse of interfaces is that we don't understand what abstractions are for. We don't design abstractions and then implement them. We build whatever classes we're going to build and keep them wrapped in 1:1 corresponding interfaces. We get the benefit of mocking but not much else.

I get more benefit from interfaces when I use them to describe what another class must depend on, from the perspective of that class. That leads to small, cohesive interfaces.

It also leads to writing the code I need, as opposed to creating dependencies first and then creating their consumers around them.

Code of Conduct Report abuse