How are patterns represented?
Previous slides describe three categories for pattern
representation outlined by Dirk Riehle and Heinz Zullighoven [1] , however
there are many variations within those forms. Very often pattern descriptions
are followed by examples, diagrams or by some other graphical
representations.
Pattern representation as a description
All of the categories described in previous slide include a description.
Description helps you to describe the context, problem and the solution in a
very natural way. No extra skills are required to understand natural language
descriptions. Unfortunately, this pattern representation is
lengthy and requires a lot of reading. It is very difficult to find an
appropriate pattern when there are so many descriptions one has to look
through
Through the example
Example is a natural way of explaining patterns, as well as many
other concepts. 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
efficiently determine
the pattern. Pattern by Example
tool by Delta Software Technology demonstrates how solutions to problems can be
generated from XML intermediate pattern representation that was derived from
example code.
Utilizing diagrams or graphical representations
"If you can't draw it it's not a pattern" [5]. Oftentimes the
diagram is given as a way to visualize a pattern. Picture is worth a
thousand of words. In object-oriented design, it is very useful to show patterns
as diagrams because objects can easily be represented as geometric shapes.
The draw back is that 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. In most cases, however, a pictorial representation of a patterns
helps to clarify concepts as well as to make those patterns much more
identifiable. A good diagram can be much more descriptive then pattern name and
can be used as a secondary description for a pattern. If patterns are
represented consistently, one can use the pattern diagram to understand the
utilization of a pattern without reading pattern description. This can
significantly speed up a job of finding the right pattern for your problem.