Polski

Behavioral patterns

Strategy

Interchangeable algorithms in separate classes, picked at runtime.

Article

Strategy: interchangeable algorithms instead of an if-else ladder

The Strategy pattern through courier assignment in a pierogi place: a family of interchangeable algorithms behind one interface, swapped at runtime. Code in C#, TypeScript, Java, Go and Python.

Related articles

Challenges

Around the topic

In this group: Behavioral patterns