Chapter 9Bigger Design Issues
In the last chapter we refactored the matches() method into a number of clearer, more-composed methods. Such continual refactoring of small bits of code helps to keep code maintenance costs low.
Writing unit tests isn’t an exercise that occurs in a vacuum. It’s instead part of the larger, continually shifting puzzle we call design. Our system’s design impacts our ability to write tests, and vice versa.
In this chapter we’ll take a look at some bigger design concerns. Specifically, we’ll focus on the Single Responsibility Principle (SRP), which guides us to small classes that increase flexibility and ease of testing, among other things. And we’ll investigate command-query separation, which uses methods that don’t ...
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