Stage 2 of 10 · 7 lessons · ~3 weeks
SOLID with before and after code
Learn the five SOLID principles as questions to ask of a design, see each one as a before and after refactoring in your language, and learn dependency injection, the technique that makes them practical.
Start: Single responsibilityLessons· one lesson for each topic, in this order
Do this
- Write a one-sentence description of every class in one project and split any that need "and".
- Replace one growing switch with an interface or a function parameter.
- Find one subclass that throws "not supported" and redesign it.
- Move one class from creating its dependencies to receiving them in the constructor.
- Write a unit test for that class using a hand-written fake.
- Undo one abstraction you added that has a single implementation and no expected change.
Start with· follow one of these
- CoursePaidGrokking SOLID Design Principles
Design Gurus · Beginner · $50 one-time
One chapter per principle, each with the violation and the refactoring that fixes it
- CourseFreeMIT 6.102: Software Construction
MIT · Intermediate
Free: the Specifications and Interfaces and Subtyping readings explain substitution as contracts
Keep handy
Also worth your time
Before moving on: A small before and after repository: one deliberately messy module, such as order checkout, refactored in separate commits for each SOLID principle, with unit tests using fakes and a short README explaining which principle each commit applies and why.

In TypeScript, SOLID often shows up as functions and types rather than classes: open/closed can be a function parameter, and interface segregation is about small object types. Learn the smell each principle prevents, then use the lightest form that removes it.