4 ms·
I think it depends on where you draw the line. In C# it's very common to use interfaces even though you only ever expect to have a single class of the given typ
by geewee 5y ago
I think it depends on where you draw the line. In C# it's very common to use interfaces even though you only ever expect to have a single class of the given type, just so you can stub it out in tests.
It's unfortunate, but some languages require you to do at least some re-architecting so it's easy to test your code.
- BurningFrog 5y agoWIthout reading the article, I'm on the "testability is a first class design criteria". Ease of testing should absolutely affect all your production code design choices. That said, there are terrible ways to do that, as always.
- mosdl 5y agoInterfaces have other advantages as well, that is an added benefit. Implementing a No Op version of an interface for tests or a simple version that uses a map instead of db calles has a lot of benefits.