//Todo: Improve Code Quality
Isolate a Dependency with a Facade
According to the Single Responsibility Principle (SRP), a class should have one reason to change. When your code directly depends on an external system, SDK, or library outside your control, every place that touches that dependency becomes a potential point of breakage the moment it changes.
That’s where the Facade Pattern earns its keep.
The Problem
Every time an external dependency changes, you’re forced to chase down and update references across your codebase. That creates instability and spreads knowledge of the dependency everywhere — exactly the opposite of maintainable design.
The Solution
Use a Facade to isolate and control that dependency. Wrap the external library, SDK, or API behind a single class that exposes only what your application truly needs. Let the Facade absorb all the changes and quirks of the dependency, keeping the rest of your system clean and focused on business logic.
The Facade becomes the single point of change the one class that changes when the dependency changes and that’s perfectly in line with SRP.
Action for This Week
Your future self (and your teammates) will thank you when the next library update doesn’t break half your system.