3 ms·
> And I think if you're avoiding writing tests to define > what your code should do you're a shoddy programmer. At the opposite end of the testing/no-test
by runeks 10y ago
> And I think if you're avoiding writing tests to define
> what your code should do you're a shoddy programmer.
At the opposite end of the testing/no-testing spectrum would be the statement: if you can't look at your own code and see whether it does what you intend it to do, but need to write a test to make sure of this, your code is either of poor quality or you're not paying enough attention.
I think both viewpoints have merit. But neither one paints the whole picture. Tests are useful to a certain degree, but since time is limited, it's all about striking the right balance between testing and no testing. You can always write more tests, but at some point it becomes more useful to just look at the code you're testing. And, conversely, you can always look at your code one extra time, but sometimes it's better to formalize your doubts into a test.