Your code is extra strongly coupled than you assume

Learn extra at:

The important thing query: Would altering thread scheduling, community latency, or a timeout alter correctness? Then you may have connascence of timing.

Connascence of worth

Connascence of worth happens when a number of values should be correctly coordinated between modules. For example, think about you may have a unit check that appears like this:


[Test]
process TestCheckoutValue {
  PriceScanner = new TPriceScanner();
  PriceScanner.Scan('Frosted Sugar Bombs');
  Assert.Equals(50, PriceScanner.CurrentBalance);
}

So we’ve written the check. Now, within the spirit of Check Pushed Growth, I’ll make the check go as simply and easily as doable.


void PriceScanner.Scan(aItem: string) {
  CurrentBalance = 50;
}

We now have tight coupling between TPriceScanner and our check. We clearly have connascence of name, as a result of each lessons depend on the identify CurrentBalance. However that’s comparatively low-level connascence, and completely acceptable. Now we have connascence of type, as a result of each should agree on the kind TPriceScanner, however once more, that’s benign. And we’ve connascence of meaning, as a result of each routines have a hard-coded dependency on the quantity 50. That must be refactored.

Turn leads into sales with free email marketing tools (en)

Leave a reply

Please enter your comment!
Please enter your name here