Design Patterns · Middle · Question 73 of 75
Why is "Adapter" useful when replacing a date library?
- ✓Correct answer: Code depends on a small internal interface (
formatDate,addDays); only the adapter changes when switching libraries - 2Adapters make bundles smaller automatically
- 3Date libraries require adapters to run
Explanation
Wrapping wide third-party APIs behind a narrow interface limits how many files a migration touches.