8

Strategy Pattern | Design Patterns in Java

 2 years ago
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.
neoserver,ios ssh client
Cover image for Strategy Pattern | Design Patterns in Java
coder4life

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK