D Dependency Inversion Principle DIP · TL;DR

1 min read
Mid-level3 min read
Rapid overview

TL;DR

DIP says high-level code (components, use-cases) should depend on abstractions, not on the concrete classes that implement them. Injecting a StorageService interface instead of new LocalStorageService() is what makes the component swap to sessionStorage, an API, or a test double without any rewrites — and it's the seam that makes unit testing possible at all.