The key question: Would changing thread scheduling, network latency, or a timeout alter correctness? Then you have connascence of timing.
Connascence of value
Connascence of value occurs when several values must be properly coordinated between modules. For instance, imagine you have a unit test that looks like this:
[Test]
procedure TestCheckoutValue {
PriceScanner = new TPriceScanner();
PriceScanner.Scan('Frosted Sugar Bombs');
Assert.Equals(50, PriceScanner.CurrentBalance);
}
So we’ve written the test. Now, in the spirit of Test Driven Development, I’ll make the test pass as easily and simply as possible.
void PriceScanner.Scan(aItem: string) {
CurrentBalance = 50;
}
We now have tight coupling between TPriceScanner
and our test. We obviously have connascence of name, because both classes rely on the name CurrentBalance
. But that’s relatively low-level connascence, and perfectly acceptable. We have connascence of type, because both must agree on the type TPriceScanner
, but again, that’s benign. And we have connascence of meaning, because both routines have a hard-coded dependency on the number 50. That should be refactored.