SOLID Design Principles
Let’s look at each principle. We’ll look at the SOLID influence on the design of some of the examples you’ve already seen in this book, as well as some new designs.
Single Responsibility Principle
The Single Responsibility Principle (SRP) states that a module should have a single responsibility—it should do one thing, and it should have a single reason to change. Applying SRP leads to modules with good cohesion, modules that are made up of functions and data with a unified purpose—in a nutshell, modules that do a job and do it well.
We’ve seen SRP at work in the modules in this book. The CircularBuffer, found in Surgically Inserted Spy , is responsible for maintaining the integrity of a FIFO data structure holding ...