GofPatterns Gofpatterns  





Design Patterns  «Prev  Next»
Lesson 3What is a design pattern?
Objective Explore Common Problems in a Traffic System.
The most common purpose of design patterns is to make classes reusable and extensible.
Design patterns do this by documenting common solutions to common problems.
Since design problems come up again and again in different contexts, it is profitable to learn to recognize common ones. Once you recognize a common problem, you can recall and reuse its solution.
A design pattern is the combination of the problem and its solution.
Programmers are familiar with the concept of an abstract data type.
Object-oriented languages and their associated separation of interface from implementation also make possible abstract algorithms; that is, algorithms that do things without precise specifications of how or even what they're doing.


Design patterns take abstraction one step further.
A design pattern abstracts something you want to do from the actual
  1. data structures,
  2. algorithms,
  3. code,
  4. classes, and
  5. objects
that fulfill a function.
It decouples the abstract from the specific.
A design pattern is not a particular class, object, data structure, or algorithm, though all of these elements are used to implement patterns.
A design pattern is the abstract structure of a common solution to a common problem. It can be implemented in different languages in different ways, and yet still retain its essential flavor.