In this section of of course we're going to take a look at the strategy design pattern and this basically
allows you to partially specify the behavior of the system and then augment it later on.
So that may have sounded a bit cryptic.
So let's talk about what this is all about.
So many algorithms can actually be decomposed into what I would call the higher and lower level parts.
For example let's consider the process of making tea.
So the process of making tea can be decomposed into something higher level like the process of making
a hot beverage.
I mean it doesn't matter whether you're making tea or coffee or any other hot drink you have to boil
the water and you have to pour the water into the cup so that is the high level part.
And then you have the two specific things.
So after you have done the high level stuff what you can do is you can take a tea bag put it into the
water you can add milk if you're British or you can add lemon or something like that.
So the high level algorithm which we specified above the process of boiling water and pouring it into
a cup can then be reused.
So the specific things are to be specific but everything else can be reused for making something else
like coffee or hot chocolate for example.
And this is supported by the beverage specific strategies.
So that is where the Strategy pattern actually comes in.
So strategy design pattern essentially enables the exact behavior of a system to be selected either
or run time.
So there are two implementations as we've seen with many design patterns this either possibility of
specifying it at runtime.
The dynamic strategy or at compile time and that would be the static strategy.
Now this pattern is also known as policy in many programming languages including especially the C++
language.