|
|
|
|
|
by self_awareness
580 days ago
|
|
I always wonder what is the motivation when people do interfaces with
just one implementation. I mean, using this logic, every single function can be hidden behind an
interface. Even the sole implementation of the interface can be hidden
behind a yet another interface. If there's just one implementation, then the interface is not necessary! |
|
- Very broad, unspecific contract that may even obscure the methods purpose
- You cannot modify the contract without modifying the class AND vice versa
- Shrinking a contract (taking away elements) is far harder and more likely to cause breakages in other code than growing a contract
- Mocks become more cumbersome because the contract is so broad
- Changes to the concrete class cause ripple effects in code that doesn't care about the change