SOLID Principles
The five SOLID principles and how they show up in real code.
7 notes · 19 min total
- 1SOLID OverviewA quick map of the five SOLID principles: what each means, how to spot a violation, and where to learn more.1 min
- 2Single Responsibility PrincipleWhy a class should have only one reason to change, and how to split a do-everything class into focused ones.2 min
- 3Open/Closed PrincipleHow to add features by adding code instead of editing it, using polymorphism, strategies and other extension points.3 min
- 4Liskov Substitution PrincipleWhy a subclass must be usable anywhere its parent is, illustrated by the Penguin and Rectangle-Square problems.3 min
- 5Interface Segregation PrincipleWhy many small, focused interfaces beat one fat interface, and how to split one so classes implement only what they use.3 min
- 6Dependency Inversion PrincipleHow depending on abstractions and injecting dependencies decouples high-level code, and why constructor injection is the default.5 min
- 7LSP vs ISPHow the Liskov Substitution and Interface Segregation principles differ in goal, symptom and fix.2 min