Following the Rhythms of TDD
We’ve seen how individual unit tests help us explore and capture design decisions about our code and keep our code defect-free and simple to use, but that’s not all they can do. TDD has rhythms that help us with the whole development cycle. By following the rhythms, we have a guide on what to do next at each step. It is helpful to have this technical structure that allows us to think deeply about engineering good code and then capture the results.
The first rhythm was covered in the last chapter. Inside each test, we have a rhythm of writing the Arrange, Act, and Assert sections. We’ll add some detailed observations on succeeding with this next. We’ll go on to cover the larger rhythm that guides us as we refine our code, known as the red, green, refactor (RGR) cycle. Together, they help us craft our code to be easy to integrate into the broader application and made of clean, simple-to-understand code. Applying these two rhythms...