Tuesday, July 25, 2006

5 steps to apply design patterns successfully

Weeks ago I’ve published a composite pattern implementation in Ruby I’ve found surfing the net. Since that day many ideas are growing in my mind, so I went for a journey into the darkness of the deepest abstraction levels and finally I have arrived to this conclusion:

We could think in a pattern as:

A set of rules which can be used to make or to generate things or parts of a
thing, especially if the things that are generated have enough in common for the
underlying pattern to be inferred or discerned, in which case the things are
said to exhibit the pattern
Years ago when the great design patterns book was published “Design Patterns: Elements of Reusable Object-Oriented Software” the world could understand how to use a well-tested solutions instead of create a new solution for every daily problem.
But time goes by, new languages emerged and day by day a lot of programmers were trying to fit that tested solutions (patterns) in their preferred languages.
Some times they’re making a big complex solution only for this reason: they want to use a pattern because it’s a tested solution, but they forgot that this is a well tested DESIGN solution. What we have here is a pattern adaptation that has changed the design pattern structure itself (not only the code, but the design too), hence they maybe could solve the same problem at lower cost without applying that pattern.


So my recipe to designers/coders is:
1 - Prepare your class diagram, with the candidates almost selected.
2 - Read the pattern definition (not the intent only!)
2 - Learn how to use it.
3 - Apply them to your class diagram when it’s possible
4 - Before coding: search well-tested implementations in your selected language
5 - Finally, face the real trade-off: to be (a new pattern inventor) or not to be, when the coding begins.

I hope this recipe works for you since it works for me and my colleagues here, by the way: I’m anxious to read your comments! What is your thought on this?

5 comments:

Anonymous said...

It works for mee too!!, but i think i'm pattern inventor! : (

Anonymous said...

Here are some links that I believe will be interested

Anonymous said...

Here are some links that I believe will be interested

Anonymous said...

Really amazing! Useful information. All the best.
»

Anonymous said...

Your website has a useful information for beginners like me.
»