But with so many patterns, how do we choose a pattern? So
this is a possible approach that you can follow. First of all, you
want to make sure that you understand your design context. You understand
what you're designing and what are the issues involved with this design. What
are the problems that you need to solve. At this point, you
can examine the patterns catalog, or,if
you're already familiar with the catalog, just
think about the possible patterns that you could use. Once you identify
the patterns that you can use, you also want to study them and
study the related patterns. So normally if you look at any pattern catalog,
for each pattern there will also be a list of related patterns. So
you can also look at those to see whether maybe some of those
might be more applicable. And finally, once you identify the pattern that you
think is appropriate, you will apply that pattern. When you do that, just
be mindful that there are pitfalls in the use of patterns. One obvious
one is the fact that you might select the wrong pattern and make
your design worse instead of better. The second one is that if you
get too excited about patterns, then you
might be abusing patterns, so just using too
many patterns, and end up with a design
that is more complicated rather than less complicated.
So always be careful, spend the time to figure out which one is the right
pattern to apply, and make sure that you
don't use patterns that you don't actually need.