I'll Be Backend
Principles

Coupling: Wrap a Third-Party Library

Coupling is how much one part of the code must change when another part changes. When business classes call a vendor's library directly, a vendor switch edits every one of them. These lessons take a car rental desk that charges cards through a payment library in two classes, move every call behind one wrapper class and an interface, and then switch vendors by adding one class.

Pick your language

When to use it

Use it when

A vendor library is called from more than one business class, or you may switch vendors.

Skip it when

The library is stable and everywhere, like the standard collections. A wrapper adds a class and hides nothing worth hiding.

Spot it by

Vendor class names, keys, units or status strings in more than one business class.