3 ms·
> TDD shines when refactoring a codebase. Treat it as a black box, document and validate the behavior, and start rebuilding the inside. This looks to me like w
by SergeAx 4y ago
> TDD shines when refactoring a codebase. Treat it as a black box, document and validate the behavior, and start rebuilding the inside.
This looks to me like writing tests around code that didn't have any before. It is crucial for refactoring to have tests; moreover, I would say that refactoring is impossible without tests. But it is not TDD, it is just adding tests where it should be in the first place.
> when you’re cobbling together a project from scratch, iterating and hacking away until something decent works, writing test code to throw it all away seems like a waste
This is exactly what TDD is for: to thoroughly think over the architecture and implement it right from the first take, without throwing away a lot of code. This is exactly the problem of people like me or author of the post: we just love coding as the process. Attention deficit greatly adds to that, making good architecture an impossible feat. It is easier for us to rewrite everything from scratch several times.