Behavioral patterns

Strategy

Define a family of interchangeable algorithms, put each in its own class, and let the client swap them at runtime, instead of a big if/else picking behaviour. An animated lesson where the diagram draws itself as the design grows.

  • Lesson 1 of 10
  • Animated diagrams

Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.

10 lessons, each with diagrams that draw themselves.

What you will learn

  • The if/else-on-algorithm smell
  • Encapsulate each algorithm
  • State vs Strategy

More low-level design

Watch Strategy take shape

Sign in and the lesson opens with its diagram ready to play, and the rest of Behavioral patterns beside it.

DSA comes with the all labs plan and every ChaiCode batch.