Learn to name well
We must be careful from now on when naming patterns. Naming is hard. This is known. Naming patterns is much harder. This is why we should probably stop naming them and refer to them only by their context and forces or use sentence-like names as was used in Christopher Alexander’s last book[Battle12]. Using forces allows users to know where to look. Specifying the context filters the results and shows alternatives that help create a deeper understanding of the patterns.
For example, instead of referring to a
- You want to offer variations on behaviour, but
- You don’t want the decision-making process limited to options you can think of right now, e.g. you wish to allow plugins or users of your library to add new possibilities, and
- You are using an object-oriented language, but
- It does not have access to function pointers, or
- You wish to serialise the choice of behaviour.
Then, a
So, what is the larger pattern? It’s dynamic behaviour, which is a bit of a
performance anti-pattern, but we’ll let that slide. Instead of demanding an
object, we record the pattern as state-determined behaviour. Some languages
don’t have a case/switch statement, some don’t have function pointers, and others
don’t have objects; however, the core purpose and value of
When naming an object-oriented version of a pattern, don’t be afraid to
use a verb nominalised into a noun. The idea of many object-oriented practices
is to create objects that represent actions. A place in which an action takes
place can be named after it.
Context rules
Whenever possible, introduce an element of the context over just describing a
pattern. Sometimes, the context is well known, and so is the solution, so
writing about it is about making sure related things are linked together.
However, in cases where the contexts are less well-known and solutions are
scarce, the context needs a vibrant presence in the pattern. You should
represent the lack to be satisfied in the name. Dark rooms or ones in which the
light is not good are referenced by the pattern
If things are different, refer to them by different names. A crash is a hang, a transaction failure, or some unexpected behaviour. Which one? A user error might be a program error, fault, bug, invalid input, misuse, mistake, or stumble. What actually happened is the cause, the problem that we want to use to name our pattern.
You can only make decisions about things of which you are aware. Some decisions can only be made by creating a new label for a new configuration. As labels often lead to a meaning or essential nature, sometimes the decision can come down to your chosen name or attributes belonging to the new label.
Ultimately, all patterns need names. Otherwise, we cannot communicate with them
as a language. But they must not be trivial.
So, name your patterns after elements that stand out, but make them discoverable by ensuring the problem is referenced, not a solution.