Design Patterns Tutorial
A tutorial on GOF design patterns. This tutorial is for beginners who are going to learn design patterns for the first time. Each pattern is expalined with suitable examples.

15/11/2013 Categories: Introduction. No Comments on What is a design pattern?

According to Christopher Alexander,

“Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.”


Definition (In Software Development):

Design patterns are repeatable or reusable solutions to commonly occurring problems in a certain context in software design.


Four essential elements of a design pattern:

The four essential elements of a design pattern are:


Pattern name: The pattern name provides a way to describe the design problem, its solution and consequences in a word or two. A pattern name provides vocabulary using which we can communicate with other people, document them and reference them in software designs. Finding a good name for a design pattern is a major issue.


Problem: The problem describes when to apply the pattern and in which context to apply the pattern. The problem may describe the class and object structures in a bad design context. Sometimes, the problem might also list out the conditions that must be pre satisfied to apply the pattern.


Solution: The solution describes the elements (classes and objects) that make up the design, their relationships, responsibilities and collaborations. The solution does not describe a particular concrete design or implementation (no code). A pattern is a template that can be applied in many different situations.


Consequences: These are the costs and benefits of applying the patterns. These consequences involve space and time trade-offs, language and implementation issues as well as the effect of pattern on system’s flexibility, extensibility or portability. Listing these consequences explicitly enables us to understand and evaluate them.

Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

Leave a Reply

Scroll Up