Behavioral design pattern: Watch a Java implementation of the Strategy Pattern which allows us to change the behavior of an algorithm at runtime. In this example there are different payment methods - strategies - for a certain amount. The context processes the payment differently depending on the payment method. A client would at runtime be able to select between the payment methods. The implementation in Main would thereby be more dynamic in a real usecase.
Top comments (0)