Using TDD to Create Good Code
We’ve seen that bad code is bad news: bad for business, bad for users, and bad for developers. Test-driven development (TDD) is a core software engineering practice that helps us keep bad code out of our systems.
The goal of this chapter is to learn the specifics of how TDD helps us to create well-engineered, correct code, and how it helps us to keep it that way. By the end, we will understand the basic principles behind good code and how TDD helps us create it. It is important for us to understand why TDD works in order to motivate us and so that we have a response to give to colleagues about why we recommend that they use it as well.
In this chapter, we’re going to cover the following main topics:
- Designing good quality code
- Revealing design flaws
- Preventing logic flaws
- Protecting against future defects
- Documenting our code