Related smells: Implicit Cross-Module Dependency, Parallel Inheritance Hierarchies, Shotgun Surgery, Shotgun Surgery, Feature Envy, Feature Envy, Inappropriate Intimacy, Inappropriate Intimacy
If enough information is available about the evolution of the grammar (e.g., in a form of a versioned repository or a piece of documentation describing all changes), one can notice two nonterminals having a so-called co-change relationship when each revision that changes one, also changes the other. The smell occurs when this co-change relationship in the revision log does not correspond to explicit dependencies between modules and nonterminals.
In the absence of change history, a thought experiment may serve the same purpose: if a nonterminal X
is to change in a particular way, what other nonterminals will have to be inevitably co-updated to preserve the consistency of the grammar? All of those, if any, are its Soulmates. It deserves mentioning that the programming counterpart of this smell, called “Feature Envy”, is often detectable automatically through static code analysis. The Soulmates smell, however, is only detectable with revision mining or conceptual analysis.