Test Driven Development Makes Software Easier To Change

-

The point of software is that it’s soft. It’s easy - or should be easy - to change in order to meet the client’s business needs.

We’ve all seen the 500 line method, that is the centerpiece of the application. It shouldn’t of happened, but it did, and it works, so no one wants to fix it.

Inevitably, the client will request functionality that will require a rework of that 500 line method.

You make the changes, and then you have to manually test the majority of the app to ensure nothing else broke. You fix any additional bugs you find during manual testing, and everything appears to be working.

By now you’ve probably spent a few days making changes, and running manual tests, so the idea of more manual testing makes you want to vomit. So you say “Let’s push it to production and hope everything works”.

Compare that to running an automated test suite that will tell you - definitively - if the system works. And it will give you feedback within minutes, rather than hours/days.

I prefer the computer validate my code rather than hoping I didn’t break anything.

If we have the tests we become fearless about making changes. If we see messy code, or an unclean structure, we can clean it without fear. Because of the tests, the code becomes malleable again. Because of the tests, software becomes soft again.

- Uncle Bob