3 ms·
> Automated tests [...] are the easiest way to write [code with fewer bugs]. Actually, automated tests are best at ensuring the code doesn't have regressions.
by dozzie 10y ago
> Automated tests [...] are the easiest way to write [code with fewer bugs].
Actually, automated tests are best at ensuring the code doesn't have
regressions. But writing bug-free code takes much more than just that; it
needs thought-out architecture and interfaces, and with those you often can
get decent code without automated tests, so no, it's not "the easiest way".
- crdoconnor 10y agoThey also serve as a form of code documentation (defining expected behavior). When doing TDD, often speed up development owing to the ability to get much quicker feedback on the code you just wrote. Code without tests has a tendency to congeal owing to the massive uncertainty surrounding changing any particular part.
- dozzie 10y ago> They also serve as a form of code documentation (defining expected behavior). Oh, far from it. Tests are not documentation, documentation is documentation. Tests can be treated as a set of examples at best.
- crdoconnor 10y agoGood well explained tests serve well as documentation. I've used them before in lieu of specifications. Bad tests not so much.