A generative pattern is one of the KindsOfPatterns
. It is first a pattern; a solution to a problem in a context. In the early days of patterns, we used the term generative
to mean creational
. But a closer reading of Alexander shows that by generative, he means something that leads to emergent behavior.
Generative patterns work indirectly; they work on the underlying structure of a problem (which may not be manifest in the problem) rather than attacking the problem directly. Good design patterns are like that: they encode the deep structure (in the Senge sense) of a solution and its associated forces, rather than cataloging a solution.
We can contrast a Generative Pattern with a GammaPattern
, which is not generative. (That doesn't make them bad, just different. Much of the software visualization work going on in the industry is all about Gamma patterns.)
I'll interpret "generative" to mean: will generate results that could not be obviously predicted; that is, using it is not just a mindless follow-the-recipe exercise.
To me, a pattern language is more interesting if it covers a range of possible solutions and it leaves the user in control of their own destiny. This is not very easy to accomplish if every problem has one "best" solution. Luckily, the real world is not this simplistic so most problems have many possible solutions, some better than others for a given context. This implies that the user of the PL must choose between several solutions (or possibly even invent a hybrid solution) which solve the problem at hand.
The forces at play tend to be the same given a particular problem, but the context in which the problem is being solved prioritizes the forces differently. This is where the sense of "tension" comes from! This "tension" cannot be resolved at pattern writing time, since the prioritization of the forces cannot be done "out of context". (Does this remind you of anything else?!?)
Since the user of the pattern is best equipped to understand the context and therefore decided what forces to optimize at the expense of the others, the user is left in a position to determine their own destiny. To me, this is what makes a pattern language "generative".
I like ChristopherAlexander
's definition of a generative pattern language in TheTimelessWayOfBuilding
An ordinary language like English is a system which allows
us to create an infinite variety of one dimensional combin-
ations of words, called sentences. ...A pattern language is a
system which allows its users to create an infinite variety
of those three dimensional combinations of patterns which we
call buildings, gardens, towns.
He goes on to say:
Thus, as in the case of natural languages, the pattern
language is generative. It not only tells us the rules of
arrangement, but shows us how to construct arrangements -
as many as we want - which satisfy the rules.
Check out "A Foreshadowing of 21st Century Art" by Alexander - is book on Persian carpet pattern making for some additional insight into generative patterns. The do not provide the "language" of his earlier architectural work but a deeper level of principles of what makes a pattern generative. Particularly his use of "spaces" in this work. -- Mike McMaster?
What's a concrete example of a generative pattern, in software or otherwise?