WHAT’S IN THIS CHAPTER?
- Writing unit-testable code
- Mastering the mechanics of test-driven development
- Testing common patterns in software engineering
There used to be a TV show called This Is Your Life. First aired in 1948, it enjoyed several revivals and specials through the 1980s. A fairly ordinary person would be surprised to find himself on the show, where his life would be reviewed. The subject’s long-lost childhood friends might make an appearance; his elementary school teacher, now in her nineties, would say how she still remembers what a good boy he was; and so on. Needless to say, the show would have quite an effect on the surprised subject, and the audience, too, would be deeply moved.
As you review the portion of your life spent in the preceding 23 chapters, you will see one friend who was always there for you: test-driven development. Over and over again, it has played an important role in making your software more reliable. In this chapter, let’s look back on that friendship. Although you may not be moved to tears as the subjects of This Is Your Life often were, we hope you will be inspired to keep test-driven development by your side.
RECALLING WHY TEST-DRIVEN DEVELOPMENT IS WORTHWHILE
Like an old friend, the unit tests of test-driven development are with you from the very beginning. They help you think through a problem ahead of time by clarifying how your program should behave, ...