Throughout this book, you’ve seen many of the unit tests I have written. In virtually every case, I used the TDD1 discipline of writing my tests and code in a tight loop, with the tests a few seconds ahead of the code.

1. I have written a great deal about this discipline in Clean Craftsmanship (Addison-Wesley, 2021), Clean Code (Pearson, 2008), and Agile Software Development: Principles, Patterns, and Practices (Pearson, 2002). There is also a vast amount of information available on the Web. One of the best books on the topic is Growing Object-Oriented Software, Guided by Tests by Steve Freeman and Nat Pryce (Addison-Wesley, 2010). ...

Get Functional Design: Principles, Patterns, and Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.