When I work with young software developers, they often are eager to learn and use
design patterns.
When they take up design, one of the first questions is ?Can I use this design pattern??
or ?I think we can
apply this pattern here, what do you say??
I have seen a number of cases where these developers use wrong patterns. This has
lead me to develop a
mixed feeling for design patterns.
On one hand, Design Patterns help us from reinventing the wheel. However, I am afraid
a lot of us have
been fitting the wrong wheel.
Design Patterns were developed by the experts so novice can follow. However, what
good is it if the
novice follows the wrong path and pick up the wrong design pattern?
When it comes to design, we don?t want to reinvent the wheel. But design is a highly
innovative, creative,
and qualitative task. Do I want all my design to be collections of a handful of design
patterns and nothing
more?
While I was giving a talk recently, I was expressing these thoughts and wanted to
emphasize it. I
realized what William Zinsser said about using clichés in writing in his book ?On
Writing Well? applies to
design.
Using several clichés makes the reading very boring. The text will loose originality.
Design patterns are clichés of software design.
If you want your design to be placid, non-original, not specific to your problem,
then I think you should
focus on design patterns first. Otherwise, focus more on the design than on the patterns.
If you should not jump into design patterns, then how can you effectively design software?
There is a
better way to design software than following design patterns. Design collectively
instead of in isolation. By
designing collectively, you can have input from different people involved. Hopefully,
some people on the
team have better understanding of design principles and goals. By doing it collectively,
you get different
perspectives. You abstraction heavily depends on perspective and you need more than
one before your design is
effective. When given a choice between designing in isolation with design patterns
on hand and collective design,
I choose the latter.