# Strategy Pattern

A pattern where interchangeable classes each hold one way of doing a task.

## What is **Strategy Pattern**?

The **Strategy pattern** puts each way of doing something in its own class and lets you swap them. A map app can switch between driving, walking and cycling route strategies.

```csharp
public interface IRouteStrategy { Route Plan(Place from, Place to); }

var planner = new RoutePlanner(new WalkingRoute());
planner.Strategy = new CyclingRoute(); // swap at run time
```

Level: Freelancer · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/freelancer)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/strategy-pattern
