Design Patterns Strategy Pattern - Design Patterns

What is Design Patterns Strategy Pattern?

In Strategy pattern, category behaviour or its algorithm can be transformed at run time. This form of design pattern comes under behaviour model.

In Strategy pattern, we create objects which represent various strategies and a context object whose behaviour varies as per its strategy object. The strategy object changes the executing algorithm of the context object.


We are available to create a Strategy interface important an action and real strategy classes implementing the Strategy boundary. Context is a class which uses a Strategy.

StrategyPatternDemo, our demo class, will use Context and strategy objects to display change in Context performance based on strategy it deploys or uses.

Step 1

Create an interface.

Step 2

Create concrete classes implementing the same interface.

Step 3

Create Context Class.

Step 4

Use the Context to observe transform in behaviour when it changes its Strategy.

Step 5

Verify the output.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Design Patterns Topics