BETA

Instability

The instability is based on the efferent and afferent coupling of the class and indicates how resilient a class is to change: 0 being very resilient & 1 very unstable. Classes using a lot of other classes are less resilient to change because changes in those others may prompt changes there.

I = efferent coupling / (efferent coupling + afferent coupling)

Classes with high efferent coupling (with lots of dependencies) but low afferent coupling (used by few others) are less stable: they're likely to be impacted by changes in their dependencies, and they don't have much depending on them so change is easy.

Stability or instability is about technical difficulty to change things, which may be at odds with the need or desire to change it. High stability is good, as long as you don't need to change the implementation often.

A class should either be as stable as possible, or as unstable as possible. Those can always be refactored later, and having the instability in a few places is better than spreading it out across the entire system.

A class should depend only on classes that are more stable that itself.