4 ms·
I catch myself doing this all the time. I'm never going to move this project off Postgres, so why the hell have I created an interface to abstract the database?
by marcus_holmes 7y ago
I catch myself doing this all the time. I'm never going to move this project off Postgres, so why the hell have I created an interface to abstract the database?
- pm90 7y agoUnit testing?
- yawgmoth 7y agoNot sure about Java, but at least in C# there are clear advantages to using interfaces over concrete classes when using Moq.
- GordonS 7y agoInterfaces are not the only option - you can also mark methods as virtual. But overuse of mocking is a very big problem in a lot of codebases. Often I look at a test, and all it seems to do is setup mocks, such that I'm not sure if anything is actually being tested! My hope is that C#'s new default interface implementations feature will put an end to this mess.