Class DistanceFromMainSequence

Distance from Main Sequence metric (D)

Robert Martin's metric that measures how far a component is from the ideal balance between abstractness and instability.

Formula: D = |A + I - 1| Where:

  • A = Abstractness (0 to 1)
  • I = Instability (0 to 1)
  • The main sequence is the line A + I = 1

Interpretation:

  • D = 0: On the main sequence (ideal)
  • D closer to 0: Better design
  • D closer to 1: Further from ideal balance

When applied to files (file-wise analysis):

  • Files that are abstract and stable (A high, I low) are on the main sequence
  • Files that are concrete and unstable (A low, I high) are on the main sequence
  • Files that are abstract and unstable are in the Zone of Uselessness
  • Files that are concrete and stable are in the Zone of Pain

Implements

Constructors

Properties

Methods

Constructors

Properties

name: string = 'DistanceFromMainSequence'
description: string = 'Distance from the Main Sequence (Robert Martin) - measures balance between abstractness and instability'

Methods