Loose coupling means components depend on what another component does, not on its specific implementation. Like booking a trip without choosing the driver or vehicle, a component can request a service without knowing who provides it. section 4.1.1
Changing how delivery details are sorted
A DeliveryDetailsPrinter that calls SorterByAddress directly must change if sorting switches to sender name. Instead, make it depend on a Sorter interface. Different sorting classes can implement that contract, so the printer can keep using the service without knowing which implementation provides it. section 4.1.1
In Spring, dependency injection can supply a bean that implements the interface. If several beans implement it, use @Primary for a default or @Qualifier to select one. This keeps the dependency explicit while leaving the implementation replaceable. section 4.5
Figure 4.3 Using an interface to decouple the responsibilities. Instead of depending directly on an implementation, the DeliveryDetailsPrinter object depends on an interface (a contract). DeliveryDetailsPrinter can use any object implementing this interface instead of being stuck to a specific implementation.

See how the printer depends on the Sorter contract rather than a particular sorting class. section 4.1.1






