Hi, today we will continue learning new patterns (see also: decorator and template). This time we will go through very popular pattern - Strategy.

Recently I wrote about template pattern. Today I would like to talk about another useful pattern - decorator.

Today I would like to show by simple example how to use template pattern in Ruby.

I'm sure you will find many ways of using that pattern in your application.

There is a great principle in object-oriented programming which says: "Tell, Don't Ask".

This principle tells that we should not ask object about their state, make decision and only then tell them what to do. Rather we should send commands.

There is a good quote about that:

2 Next →