The advantages of TDD
TDD comes with advantages and disadvantages. These are the main advantages:
- You only write code that is needed: You should stop writing production code when all your tests pass and you can't think of another test to write. If your project needs another feature, you need a test to drive the implementation of that feature. The code you write is the simplest code possible. So, all the code ending up in the product is actually needed to implement the features.
- More modular design: In TDD, you concentrate on one microfeature at a time. And as you write the test first, the code automatically becomes easy to test. Code that is easy to test has a clear interface. This results in a modular design for your app.
- Easier to maintain: As the different parts of your app are decoupled from each other and have clear interfaces, the code becomes easier to maintain. You can exchange the implementation of a microfeature with a better implementation without affecting...