THE BENEFITS OF TDD
The primary benefit of TDD is having a suite of tests that you can call on at any time to verify the correct functionality of your application. This in itself is a tremendous benefit. It ensures that the application always works as described. A suite of passing tests ensures that as development continues, existing functionality is not damaged. Other indirect benefits of TDD are worth noting:
- Better design — To really take advantage of TDD, your application should make liberal use of the DI pattern. The use of DI promotes loose coupling in your application. No service or component is statically bound to another. This introduces a great deal of flexibility in your application, leaving it open to change and extension.
Most practitioners of TDD employ the SOLID Principles. Whether this is by design or is a side effect of writing testable code, the result is the same. The code that is written is easier to understand, more maintainable, and extremely flexible. This translates into code that delivers a high degree of quality to the client.
- Fewer defects — By practicing TDD, you are writing working business code, not defects. Because you have a suite of tests that accurately reflect the business needs and requirements, and because those tests pass, you can feel confident that your code contains few, if any, defects resulting from the business requirements being incorrectly implemented. Defects may still arise from defective or incomplete requirements. You handle these ...