Strategy Pattern | Design Patterns in Java
source link: https://dev.to/coder4_life/strategy-pattern-design-patterns-in-java-me
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Posted on Dec 13
Strategy Pattern | Design Patterns in Java
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK