November 13, 2011

...Learn TDD with Codemanship

The Version Substitution Principle

Carrying on from my last blog post about backwards compatibility with previous versions of a component, it's a bit like the Liskov Substitution Principle (part of S.O.L.I.D.) - only applying to new versions of classes.

I propose a new design principle to make it official.

Version Substitution Principle

A version of any component can be substituted with any later versions of that component.

What this means in practice is that new versions of a component (e.g., a DLL) must fulfil the contracts of the previous version such that existing client code is unaffected by an upgrade.

As I suggested in the last blog post, we can check this by running the tests that speak to the component's public interfaces of the previous version against our new version. Provided, of course, that we have such tests and that they provide sufficient assurance that contracts are being fulfilled.

If you're working on libraries and frameworks, or on components within a larger software system, this is worthwile, I tend to find.






Posted 6 years, 6 months ago on November 13, 2011