As part of a long-term background project to organize patterns for OO design, I started thinking about the relationships between patterns. I find there are three key relationships which helped me to organize the patterns into some kind of structure, without getting too bogged down in fine detail.
-- JamesNoble
The really seminal work on relationships between the GangOfFour design patterns is in WalterZimmer?'s paper in PatternLanguagesOfProgramDesign-1.
Another important paper is GerardMeszaros and Doble's "Patterns for Pattern Writing" in PLoPD3 discusses five relationships between patterns - the three above, and inverses for uses and specializes.
Another set of works - though perhaps not as seminal as WalterZimmer?'s - is Alexander's books. He talks about PatternContains - not specializes or uses. It's so simple - why have we wandered elsewhere?
This is fundamental to an understanding of PatternLanguages, which is in turn fundamental to an understanding of patterns.
I agree Alexander's books are the genesis of patterns, and that chapter 16 of TheTimelessWayOfBuilding gives a good definition of Alexander's PatternsContains? relationship, MorphologicalCompleteness?, FunctionalCompleteness?, and PrincipalComponents?. I also think these ideas are vital to understanding patterns.
What I propose to call PatternUses is basically Alexander's PatternsContains? relationship - it is the most important relationship between patterns. I propose the name PatternUses because it is seemed to be to be the term most commonly used to describe this relationship in OO design patterns. People write "The FlyweightFactory? may use the Singleton pattern" rather than "contains the SingletonPattern". Also, there were debates about the terms refinement (PatternRefines?) and containment (PatternContains) - see PatternLanguageTaxonomy - so I hoped to find a new unambiguous term, which most people could understand easily albeit shallowly. Of course, there's probably some academic hubris involved too :-)
Why have we wandered elsewhere? I don't know. PostAlexandrian? PatternAuthors? and PatternLanguageCompilers? have used a number of terms describe the relationships between their patterns - I counted about ten other relationships which seem to have some currency in this young literature. I think that the three relationships PatternUses (which is the most important), PatternSpecializes, and PatternConflicts can describe most of these relationships, with a much simpler vocabulary. These relationships are typically used informally by PatternAuthors? to describe their patterns (I've added some references to the relationship pages), and I have found them useful for organizing patterns into PatternLanguageFragments, and have some hope they will help organize whole PatternLanguages.
AlexandersPatternLanguage? seems to have some examples of PatternSpecializes, but few clear examples of PatternConflicts. OO Design Patterns seem to have lots of PatternConflicts. I don't know why there is this difference.
-- JamesNoble (signed to indicate opinion/research, not accepted fact :-)
I don't know why there is this difference.
Maybe because Alexander's patterns tell you how to build things out of (within the constraints of) given materials, whereas computing, and especially OO, is about making your own materials that fit the problem.
Alexander's contains relationship is everywhere, of course. The other relationships are implicit in Alexander's patterns, but are not brought out explicitly. For example, given a small area of space under a stairway, you can make it either a ChildCave?, BulkStorage?, or SecretPlace, you can't make it all three because their solutions are so different - the patterns conflict. Similarly, SequencesOfSittingSpaces? is a specialized kind of IntimacyGradient?, and so on.
-- JamesNoble