3 April 2007

Long-lived systems: decoupling

By Andrew Clifford

Systems that are clearly separated from each other live longer than systems that are coupled.

If two systems are coupled, then change in one system forces change in another. All too often the forced change is carried out in a hurry which undermines the structure and documentation of the system and reduces its life expectancy.

It works the other way too. Sometimes we need to rework a system to keep it running smoothly, but the impact on other systems is just too great and we do not bother.

Heavy coupling means you can not change one system without changing every system. It forces you into major redevelopments every few years. It stops you making the small, timely changes that can keep systems running indefinitely.

Coupling occurs when you connect systems, but of course you do need to connect systems to get them to work together. To keep systems decoupled, limit the knowledge that one system has of another to only the interfaces that they share. This gives you the freedom to change the internals of any system without affecting others.

There are many dimensions to decoupling.

You can achieve a high level of decoupling by making decoupling a priority when you connect systems. See Minimal integration for some ideas on this.

Look out for other, subtle forms of coupling.

Heavy coupling is a death sentence to systems. It is much harder to retrofit decoupling than to design it in. If you want long-lived systems, always make decoupling a high priority in design, and never give in to short-term pressures to bypass good decoupling discipline.