Strategy pattern

The strategy pattern is a [design pattern] used to define a series of interchangeable algorithms that can be selected and changed at runtime according to business needs. It allows an application to dynamically adapt and apply different behaviors under different conditions.

Example:

Consider a logistics system that can use different shipping cost calculation strategies depending on the region and urgency of the shipment. You could have a ShippingCalculationStrategy interface with several implementations like StandardShipping, ExpressShipping, and InternationalShipping. The system can dynamically change the shipping calculation strategy depending on the destination and delivery speed selected by the customer.