Happy families are all alike; every unhappy family is unhappy in its own way. – Leo Tolstoy’s
Once upon a time, there was a girl living happily in the deep forrest. She did not know where she came, nor where she is suppose to be. The only unfamiliar memory she had is that many years ago, before she could wake up from the cold and molded stone, she heard a distance whisper, saying “home, home, this is your home”.
She was terrified of the world when she woke up. Everything is so strange, so unspeakably complicated. And worst of all, there was even no language in her head that can explain what she is going through.
She stood up and started to walk, then she noticed something different which helped her understand the world a little better: a lot of moving creatures were afraid of her!
Rabbits jumped away.
Birds flied away.
Squirrels climbed up the trees.
Hedgehog put their heads under the shells…
“Ha, I have the power to expel creatures!” She felt a current of great excitement going through her body and she continued walking.
Animals spoke in the background, “yes, we all escape. You got it. But we do it differently.”
The Strategy Pattern defines a family of algorithms, encapsulates each one and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. — HeadFirst