Introduction: Driving Design—TDD and SOLID

Get an introduction to what you’ll learn in this chapter.

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’re going to need to be able to handle designs of greater complexity. To do that, we’re going to apply some recommended approaches to assessing what makes one design preferable to another.

The SOLID principles in code design

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. These principles have existed long before they were known by this name. They have proven helpful, and it is worth understanding the benefits each one brings and how we can apply them to our code. To do that, we’ll use a running code example in this chapter. It’s a simple program that draws shapes of various kinds using simple American Standard Code for Information Interchange (ASCII) art on a console.

Get hands-on with 1400+ tech skills courses.