Class LakosMetrics

java.lang.Object
com.tngtech.archunit.library.metrics.LakosMetrics

@PublicAPI(usage=ACCESS) public final class LakosMetrics extends Object
Calculates architecture metrics as defined by John Lakos in his book "Large-Scale C++ Software Design".
To calculate these metrics every component is assigned a "dependsOn" value that represents the number of other components that this component can reach transitively, including itself. Take e.g. components

 A -> B -> C
 A -> D
 
Then dependsOn(A) = 4, dependsOn(B) = 2, dependsOn(C) = 1, dependsOn(D) = 1
The Lakos metrics are then calculated as:

  • Cumulative Component Dependency (CCD): The sum of all dependsOn values of all components
  • Average Component Dependency (ACD): The CCD divided by the number of all components
  • Relative Average Component Dependency (RACD): The ACD divided by the number of all components
  • Normalized Cumulative Component Dependency (NCCD): The CCD of the system divided by the CCD of a balanced binary tree with the same number of components

Given the example graph above we would obtain CCD = 4 + 2 + 1 + 1 = 8, ACD = 8 / 4 = 2, RACD = 2 / 4 = 0.5, NCCD = 8 / 8 = 1.0