Mantra: Red, Green, Repeat
Each chapter of this book concludes with a mantra, a phrase you can repeat to yourself whenever you’re feeling unfocused to bring clarity. This chapter’s mantra—“Red, green, repeat”—encapsulates test-driven development (TDD) in a nutshell. Whenever you feel stuck, let the mantra guide you. In the long term, the habit of putting tests first helps to form a healthy mindset for problem solving, one in which failing code evokes curiosity instead of despair.
In the abstract, the act of writing tests before code may seem inconsequential. Writing code and writing tests are, one might imagine, two activities that can be done in any order with identical results. But imagining is one thing; hands-on experience is another. If ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access