What are design patterns?

Here are what some authors have said about design patterns:

A Brief History of Design Patterns and the "Gang of Four"

The concept of patterns (in general) was originally articulated by Christopher Alexander and colleagues in the late 1970s [The Timeless Way of Building, 1979; A Pattern Language—Towns, Buildings, Construction, 1977] (They had 253 patterns.)

Somewhat later, it was recognized that there are many similarities between software design and architectural design:

Pioneering work in this area was done by the so-called "Gang of Four". [See their seminal text on the subject: Design Patterns (Elements of Reusable Object-Oriented Software), Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, 1995]

Design Patterns became a best-seller, is now regarded as a "ground-breaking" work, and the rest is history: Design patterns have been accepted as a very useful tool by the software development community at large.

Many additional patterns have been identified and described, and more appear all the time.

In a very small way, you are familiar with a number of "mini design patterns". A very small pattern in a programming language is sometimes called an idiom. Can you think of any examples?

The Three-Step Design Pattern Learning Process

  1. Acceptance Accept the fact design patterns are going to be important in your software development work.
  2. Recognition Recognize the need to read about and "watch for" design patterns in order to know when you might use them.
  3. Internalization Finally, you "internalize" the patterns in sufficient detail that you know ("instinctively"?) which one(s) might help you solve a given problem.

The 23 Original Design Patterns (in Three Categories)
(from Java Design Patterns, JW Cooper, 2000)

Design patterns are essentially language-independent, but are often presented in a language-sensitive way, using either Smalltalk, C++ or Java to illustrate or explain how the pattern works.

The process of "looking for patterns" is called pattern mining. Patterns need to be "recognized" or "discovered", and new ones are "showing up" and being described continually. The original 23 design patterns of the Gang of Four are often grouped into the following three categories:

Other Design Patterns

As we hinted at above, there are now at least hundreds, and perhaps thousands, of design patterns being used by software developers. Many of them apply to very specific situations, and are of little interest outside a particular field of endeavor. But there are also quite a number of additional design patterns of general applicability. We may add to the list given below, from time to time, as we encounter new patterns that are of some use or interest.

The Parts of Any Design Pattern

At a minimum, any design pattern must provide the following:

There are more elaborate schemes. For example, Design Patterns uses the following sections in its descriptive scheme for each pattern: