Skip to main content

Module instability

Module instability 

Source
Expand description

Martin’s instability metric — per-namespace afferent / efferent coupling from inter-package edges, and Stable Dependencies Principle violations.

For every namespace (package) in the graph: Ca = afferent coupling — # of inter-namespace edges arriving at this namespace Ce = efferent coupling — # of inter-namespace edges leaving this namespace I = Ce / (Ca + Ce) — in [0.0, 1.0] I = 0 → maximally stable, I = 1 → maximally unstable.

An inter-namespace edge A → B violates the Stable Dependencies Principle when I(A) < I(B) — a more-stable package depends on a less-stable one.

See DESIGN.md (Phase 2) at the workspace root.

Structs§

NamespaceInstability
Coupling counts and instability for a single namespace.
SdpViolation
An inter-namespace edge whose source is more stable than its target.

Functions§

compute_instability
Compute Ca / Ce / I for every namespace in graph.
find_sdp_violations
Find every inter-namespace edge that violates the Stable Dependencies Principle.
instability
Single-value formula. None when the namespace is isolated (Ca + Ce == 0).