Introduction: Driving Design—TDD and SOLID

Get yourself introduced to what we will learn in this section.

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.

SOLID principle 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 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 section. It is 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 1200+ tech skills courses.