How are patterns represented?
- Through the use of the properties described in the previous slide
This is a common approach in books about Design Patterns. When
you want to teach someone a design pattern, you need to give as much helpful
information as possible. Unfortunately, this pattern representation is
lengthy and requires a lot of reading. It is very difficult to find an
appropriate pattern when you have to read description of every pattern.
- By utilizing diagrams or graphical representations
"If you can't draw it it's not a pattern". Oftentimes the
diagram is given as a way to visualize a pattern. Picture is worth a
thousand words. It is very useful in object-oriented design to show patterns
as diagrams because objects can easily be represented as geometric shapes.
The draw back is the picture is not a substitute for a pattern description.
You may identify the pattern that you already know from its diagram, but you
will not be able to use it if all you have is a pictorial representation.
And there are some cases when the diagram cannot be easily drawn for the
pattern.
- Through the example
Example is a natural way in explaining not just patterns but just about
anything. Example is usually included with any good pattern definition. It
might be difficult to determine what the problem is or which pattern it
represents just by looking at the example. Still, example will let you see
the solution to the similar problem and from that most people can determine
the pattern right away.