Core Idea

The abstractness-instability metric, introduced by Robert C. Martin, evaluates module design quality by examining the relationship between two independent dimensions: how abstract a module is and how stable it is. Well-designed modules follow the “main sequence” — a balanced diagonal where stable modules are abstract and unstable modules are concrete.

The Two Dimensions

This metric combines two independent measurements — see their individual notes for full definitions:

  • Abstractness (A): Ratio of abstract elements to total elements (0.0 = fully concrete, 1.0 = fully abstract)
  • Instability (I): Ratio of outgoing to total dependencies (0.0 = highly stable, 1.0 = highly unstable)

The Main Sequence

The relationship between A and I reveals architectural quality. The “main sequence” is a diagonal from (I=0, A=1) to (I=1, A=0) representing the ideal balance:

Module CharacteristicIdeal Design
High stability (low I) — many dependentsHigh abstractness (high A) — flexible for extension
High instability (high I) — few dependentsConcrete (low A) — safe to change frequently

Modules that deviate from this line fall into one of two problem zones:

  • Zone of Pain (high stability + low abstractness): Concrete implementations that many modules depend on. Changes are both necessary and dangerous — maintenance bottlenecks result.
  • Zone of Uselessness (high instability + high abstractness): Abstractions that nothing depends on. Over-engineering: flexibility where no client needs it.

Refactoring Guidance

  • Zone of Pain → move toward abstraction: extract interfaces, apply dependency inversion
  • Zone of Uselessness → simplify: remove unnecessary abstractions, consolidate concrete implementations

Unlike subjective code reviews, these are objective and automatable. The Distance-from-Main-Sequence metric (D = |A + I - 1|) quantifies exactly how far a module deviates from the ideal.

Sources

  • Martin, Robert C. (1994). “OO Design Quality Metrics: An Analysis of Dependencies.” Workshop Pragmatic and Theoretical Directions in Object-Oriented Software Metrics, OOPSLA ‘94.

    • Original paper introducing abstractness, instability, and main sequence concepts
  • Richards, Mark and Neal Ford (2020). Fundamentals of Software Architecture: An Engineering Approach. O’Reilly Media. ISBN: 978-1-492-04345-4.

  • Martin, Robert C. (2017). Clean Architecture: A Craftsman’s Guide to Software Structure and Design. Prentice Hall. ISBN: 978-0-13-449416-6.

    • Chapter 14: Component Coupling — practical examples

Note

This content was drafted with assistance from AI tools for research, organization, and initial content generation. All final content has been reviewed, fact-checked, and edited by the author to ensure accuracy and alignment with the author’s intentions and perspective.