Posts Tagged: strategy pattern


5
Mar 09

Memory Palace method example: Strategy pattern

This post is a sequel of previous How to start using Design Patterns post, describing the Memory Palace memorization method. I recommend you to read it before starting to read this post.

For example, I can use my sitting room as a basis for the remembering path. In this room I have the following objects:
Table, big bright window, lamp, sofa, picture on the wall, small bookcase, CD rack, telephone, television, DVD player, chair, mirror, black and white photographs, etc.

I want to put all the units required for remembering the StrategyContext implementation in that room. I’ll start from window and will move to the door out of the room.

When I hear the word “strategy”, the first image comes to my mind is an ancient roman warrior with armors. “Context” associates with Jacuzzi for me(something that surrounds you). So I “see” the roman warrior sitting in the Jacuzzi(pay attention at bubbles and moist air in the room).

Here is an example implementation of the GoF Strategy pattern, main concept of which we want to remember:
I’ve taken it at Strategy PHP example from software pattern catalog:
Continue reading →