Summary
In this chapter, we’ve looked at simple explanations of how the SOLID principles help us design both our production code and our tests. We’ve worked through an example design that uses all five SOLID principles. In future work, we can apply SRP to help us understand our design and limit the rework involved in future changes. We can apply DIP to split up our code into independent small pieces, leaving each piece to hide some of the details of our overall program, creating a divide-and-conquer effect. Using LSP, we can create objects that can be safely and easily swapped. OCP helps us design software that is simple to add functionality to. ISP will keep our interfaces small and easy to understand.
The next chapter puts these principles to use to solve a problem in testing—how do we test the collaborations between our objects?