The Basics of Design Patterns
Join the DZone community and get the full member experience.
Join For Freewhat 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.
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 Prathap Givantha Kalansuriya. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments