Applying SOLID Together

Applying the SOLID principles together: diagnosing a class that breaks several, refactoring it safely behind tests, and knowing when to stop.

  • 7 cards
  • 5 questions
  • About 16 min
  • Intermediate to Advanced
Share

Real classes rarely break one SOLID principle at a time. This topic puts the five together: how they depend on one another, how to refactor a class that breaks all of them without breaking what it does, and how far to go.

It starts with the relationships between the principles, then refactors a checkout class that breaks all five principles, one principle at a time, with the same tests passing after every step. A notification service follows, reached by the same reasoning from a different starting point, and a comparison shows what changes when Python's duck typing replaces declared interfaces.

The last cards show a refactor that went wrong because nothing pinned today's behaviour, and give you five short classes to diagnose.

By the end you can name the principle a design breaks from its symptom, explain how the principles support each other, order a safe refactor, and say what duck typing changes in Python.

Contents

7 cardsnot started