Driving Design – TDD and SOLID
So far, we’ve created some basic unit tests that have driven out a simple design for a couple of classes. We’ve experienced how test-driven development (TDD) makes decision-making about design choices central. In order to build out to a larger application, we are going to need to be able to handle designs of greater complexity. To do this, we are going to apply some recommended approaches to assessing what makes one design preferable to another.
The SOLID principles are five design guidelines that steer designs toward being more flexible and modular. The word SOLID is an acronym, where each letter represents one of five principles whose names begin with that letter. These principles existed long before they were known by this name. They have proven helpful in my experience, and it is worth understanding the benefits each one brings and how we can apply them to our code. To do this, we will use a running code example in this chapter...