Before I understood what design patterns were, I had a hard time trying to understand the difference between Design Patterns and Frameworks.
Design Patterns :
When you encounter a specific kind of problem during design, you group similar problems and apply a common solution to them and that solution is a design pattern. For eg, in an Email application, my email view (Inbox) has to be updated everytime I receive a mail. In a Stock Trading application, share prices of my portfolio has to be updated (I might view my portfolio as a chart / graph / etc) everytime the share price in the market changes. A common solution to this pattern of problem is called Observer pattern (you could use Model-View-Controller) as well where you have a Subject (email application / stock trading application) updating an observer(Inbox / Chart/ Graph of the trading appln) of any changes. It definitely takes experience to apply the right design pattern to the right problem.
Framework :
A framework is a set of classes and interfaces that make up a reusable design. It is built on top of one or more design patterns and have supporting class libraries to help design reuse. For eg, Struts framework provides a bunch of supporting libraries for a Model-View-Controller design pattern.
Some of the differences specified in the GOF book are
1. Design patterns are more abstract than frameworks.
2. Design patterns are smaller architectural elements that frameworks.
3. Design patterns are less specialized than frameworks.
No comments:
Post a Comment