Patterns are about communicating problems and solutions. Simply put, patterns enable us to document a known recurring problem and its solution in a particular context, and to communicate this knowledge to others. One of the key elements in the previous statement is the word recurring, since the goal of the pattern is to foster conceptual reuse over time.
We explore this in more detail in Chapter 5, in the section "What Is a Pattern?" on page 118.
This well-known pattern definition comes from Christopher Alexander in A Pattern Language [Alex2]:
Each pattern is a three-part rule, which expresses a relation between a certain context, a problem, and a solution.
—Christopher Alexander
Alexander expands his definition further, and noted patterns figure Richard Gabriel [Gabriel] discusses this definition in more detail [Hillside]. Gabriel offers his own version of Alexander's definition as applied to software:
Each pattern is a three-part rule, which expresses a relation between a certain context, a certain system of forces which occurs repeatedly in that context, and a certain software configuration which allows these forces to resolve themselves. [See A Timeless Way of Hacking.]
—Richard Gabriel
This is a fairly rigorous definition, but there are also much looser ones. For example, Martin Fowler offers the following definition in Analysis Patterns [Fowler2]:
A pattern is an idea that has been useful in one practical context and will probably be useful in others.
—Martin Fowler
As you can see, there are many definitions for a pattern, but all these definitions have a common theme relating to the recurrence of a problem/solution pair in a particular context.
Some of the common characteristics of patterns are as follows:
-
Patterns are observed through experience.
-
Patterns are typically written in a structured format (see "Pattern Template" on page 129).
-
Patterns prevent reinventing the wheel.
-
Patterns exist at different levels of abstraction.
-
Patterns undergo continuous improvement.
-
Patterns are reusable artifacts.
-
Patterns communicate designs and best practices.
-
Patterns can be used together to solve a larger problem.
Many great minds have spent a significant amount of time attempting to define and refine the notion of a software pattern. Suffice it to say, we do not presume to be great minds, nor do we wish to spend time expanding these discussions. Instead, we attempt to be true to aspects of these various definitions, focusing on the most simple and recurring theme in each.
---------------from Core J2ee Patterns