Prathap Givantha has posted 4 posts at DZone. You can read more from them at their website. View Full User Profile

The Basics of Design Patterns

09.18.2012
| 5412 views |
  • submit to reddit

What is a Pattern?

A Pattern is a solution to a problem in a context.

Context : is the situation in which the pattern applies.This should be a recurring situation

Problem : refers to the goal you are trying to achieve in this context. But it also refers to any constraints that occur in the context.

Solution : is what you are after: a general design that anyone can apply which resolves the goal and the set of constraints.

This means, a Design Pattern gives you a solution to a common recurring design problem, However,The Design Patterns are not meant to be laws or rules; they are just guidelines that you can even alter to fit to your needs

The first and the most definite Fundamental Design Pattern Catalog is GOF, There are 23 fundamental patterns in it.

Before Start Learning the Design Pattern you need to Knowing the OO basics (Abstraction,Encapsulation, Inheritance, Polymorphism) will
not make you a good designer :) ,Patterns do not give you code. They give general solutions to design problemsPatterns are not invented they are discovered.

To learn patterns faster, they can be classified as,

Creational Patterns: Used to construct objects such that they can be decoupled from their implementing system.

Structural Patterns: Used to form large object structures between many disparate objects.

Behavioral Patterns: Used to manage algorithms, relationships, and responsibilities between objects.


Reference Head First Design Pattern Book

We need to use Design Patterns as a tool, which only be used when it is needed, Otherwise Heavy use of patterns will lead to complexity. Now I thing you have a clear idea about What is Design Pattern ?

Thanks, Have a great day :)

Published at DZone with permission of its author, Prathap Givantha Kalansuriya. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)