DEV Community

Discussion on: Is testability a reason to change your design?

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Having a testable design is important. However, I'm against unncessary abstractions for the purpose of testing. It oftens leads to the false abstraction anti-pattern. There are many ways to test code without adding much complexity. I think mocking as a means to testing has run wild on many projects.

Collapse
 
n_develop profile image
Lars Richter

I agree, that having a testable design is important. ☺️
But I can see your point. If the code gets overly complex just for the purpose of testing, it's not a good thing. I really don't want to promote a "testability and abstractions are the cure for everything" thought. Always use the right tool for the right job. That's important.

BUT: I don't think a single interface isn't increasing the complexity of a software system pretty much. But it might increase the testability a lot.

In the end it is a matter of your personal priorities and opinions.

For me, testability is important. I have seen the same bug get in the code over and over again. A good set of tests can prevent that.