Messed up code happens in every codebase, but for it to really be prevalent requires an ecosystem that makes it a appear to be the best choice most of the time. Small issues in a codebase continue to pile up until someone suggests a complete rewrite to fix it.

Test driven development is a different way to think about the design, development, and maintenance of applications. TDD can work well for you, but it’s easy to go off the rails, especially with the kind of examples you see on the web. The basics are easy, but it can be tricky to get right. It takes a while to learn all the hard lessons of TDD, but the goal is ultimately worth it.