Emergent, not idiomatic

When asked for a one-sentence characterisation of a pattern, I will usually reel off something like: ‘A pattern is a self-reinforcing configuration formed as a response to a set of forces in a context, whether for ill or good’. The word solution is absent, and I call out how the final form is not necessarily advantageous for those involved. These are important distinctions because so much of the design pattern movement has hinged on them all being solutions of some form, and little is understood about their effects on the health of their hosts.

The aspect of patterns always being positive is something that people might take for granted. Patterns aren’t good; they are just that self-forming, self-reinforcing aspect. Otherwise, we wouldn’t have anti-patterns. Or, at least not in the form I think of them now.

Notably, the value of a pattern can change over time, just as a species can be effective in one environment and mediocre in another. A pattern can be healthy in one context and unhealthy in another. The only constant is their self-forming, self-reinforcing, or autopoietic nature in the presence of forces in a context.

This emergent nature is not only fundamental to them not being idiomatic but also part of the verification process carried out by Christopher Alexander. Good patterns emerge. You find them by looking for how to resolve forces. When you successfully resolve them in a context for the first time, you often find a pattern has been staring you in the face throughout your endeavour. You may also find you have reinvented something. This is because common problems, when resolved fully, tend to have solutions with lots of common properties. And that’s the essence of a design pattern.

A pattern recurs because of the common properties of a problem. But some problems seem vague. Others only require those involved to agree. Here, an idiom suffices, something we accept as true. It is not self-forming or naturally occurring, but forming an agreement is natural. Idioms are always the things we have to agree on to make progress because a wrong answer is difficult to judge. They can often be completely unfalsifiable, such as the tabs vs. spaces arguments or bracing style wars.

Idioms contain inertia. Patterns, being emergent, collapse when the situation changes. Some idioms fight back. They don’t allow themselves to change in response to new data. They repeat again and again the same not quite right solution. They are a cultural phenomenon. An idiom is a convention. Conventions are difficult to repair, as there’s usually a lot of personal investment and apparent value built on these imperfect foundations.

Patterns emerge by themselves; we agree upon idioms. Because of this, idioms are less likely to be detrimental when they first arrive. We judged, balanced, and consciously accepted our idioms at some point. Patterns result from forces, and the solution gravity well forms around what resolves them. But that means the solution does not need to be judged by anyone before it becomes the norm.

In effect, anti-patterns exist because they satisfy the pattern, not the entities involved. The entities involved might have opinions about the solution’s value, but that’s a different context from that of the pattern. This means that a pattern can become an anti-pattern, and an anti-pattern can become a pattern when we judge it from a different context.