One reason someone might make the mistake is that the drawings proliferate like dandelions.
Yet, the drawings are just vehicles.
A drawing may help me communicate to someone the essence of a design pattern. In fact, several drawings are almost always required to do so.
That doesn't mean we should let a drawing confine us to a particular design, just because it was used to explain an example of that kind of design at some point in the past.
I'll discuss design patterns more in future entries but I'll leave you with a puzzle.
The image at the bottom of this entry depicts three the implementation of three patterns, with all the names removed. There's a State, Strategy, and Template method pattern in it. The Template method is implemented the way I prefer.
Can you guess which drawing matches which pattern?
Well... which is which? |