# Strategy or Template Method?

Strategy and Template Method both let one step of a routine vary: Strategy hands the step in as an object or function (has-a), Template Method leaves it for a subclass to fill in (is-a); a look-alike table, a run-time change and a second varying step show what each costs, and why most teams reach for Strategy first.

![Cheat sheet: Strategy or Template Method?](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/c9cd28993afb407f82949207390124cc.webp)

- Category: Data Structures
- Level: Journeyman
- Tags: Composition over Inheritance, OOP, Strategy Pattern, Template Method Pattern
- Author: Gregor Dzierzon
- Updated: November 17, 2026

Source: https://www.ask-codey.com/cheat-sheets/dp-strategy-vs-template-method-cheat-sheet
