Wednesday, April 1, 2009

Quick review of Design patterns

What is a design pattern and why it is so popular in the software industry? Is it restricted to software or can it be used in any area? When did it originate and how it became accepted by the world?

What is a design pattern?
When we give this question to Google, we get a definition from the wiki that "A pattern is the idea of capturing the architectural design ideas as resuable descriptions". This might be a bit complex to understand. But let me try to explain the same in my way! Let me take an example of preparing tea. Anybody can prepare tea in many number of ways. The main ingredients of tea are water,tea powder,sugar n milk. The last two are optional. The most common way is boiling the water, adding the tea powder. May be we can add the tea powder to the water and then boil the water. But this might take a little longer than the first way as water boils faster than a mix of tea + water. Hence the first way gives us more performance than the second one. When we prepare tea at home, this is not necessary, but try to think about a tea shop. Let me say here that adding the tea powder after the water boils is a pattern! Will this work for preparing coffee as well? Yes. So I can put the definition of pattern as "A reusable procedure that when implemented or used in various processes like software/manufacturing/healthcare or any other businesses gives the most perfect results." Ofcourse any procedure that does not give the perfect output can never be universally accepted. Also since its defined and proven already, implementing that is easier.

Is it restricted to software or can it be used in any area? When did it originate and how it became accepted by the world?
Patterns as the word says originated as an architectural concept in 1977 by Christopher Alexander. Software Industry made them popular! Yes. In 1987, Kent Beck and Ward Cunningham tried to define their ideas as patterns and applied them in their programming. Again, it was Erich Gamma who popularised those concepts through his book " Design Patterns: Elements of Reusable Object-Oriented Software ". Thus slowly, the concept of design patterns penetrated into the software world along with the OOAD concepts which directly points to C++ and mostly Java. Most of the design patterns are based on the object oriented concepts and are used by people who talk about objects.

Now we know about the origin of design patterns. We can pass on to the various types of design patterns that are defined already and being used in various applications.