Design Patterns · Middle · Question 13 of 75

How does Template Method differ from Strategy?

Explanation

Template Method fixes the algorithm's skeleton in a base class, and the variation is set by a subclass (statically). A strategy is passed to an object and can change at runtime. In JS, composition is usually preferred: pass step functions.

Further reading

Problem with a question

Design Patterns · Middle · question 13

Test yourself

Take the Design Patterns · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz