concept
composition
The characteristics of
Application scenarios
- Multiple classes differ only in their behavior, so you can use the Strategy pattern to dynamically select the specific behavior to be performed at run time.
implementation
- Different policies (algorithms) need to be used in different situations, or policies may be implemented in other ways in the future.
- The implementation details of specific policies (algorithms) are hidden from the customer, completely independent of each other