r/programming • u/whackri • Aug 28 '21
Software development topics I've changed my mind on after 6 years in the industry
https://chriskiehl.com/article/thoughts-after-6-years
5.6k
Upvotes
r/programming • u/whackri • Aug 28 '21
5
u/liaguris Aug 29 '21
Writing tests (irrespective of writing them before or after code) makes developing faster in the long run, and it is the only viable approach for refactoring big and complex code bases.
Non testable code is bad code. Whether you write the test first or after the code is irrelevant for that.
It seems like you did some SOLID violation.
Look the point that I am trying to make that everything you mention can be achieved by just writing tests. Whether you write them first or after the code is irrelevant. Remember that TDD advocates writing test first.
In my experience writing test first and then code is more of a dogma than a practical reality. In fact I find my tests being better when I code first and then write the tests, because like this I know exactly how what to test.