Class LakosMetrics
java.lang.Object
com.tngtech.archunit.library.metrics.LakosMetrics
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
The Lakos metrics are then calculated as:
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) = 1The 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
CCD = 4 + 2 + 1 + 1 = 8, ACD = 8 / 4 = 2, RACD = 2 / 4 = 0.5, NCCD = 8 / 8 = 1.0-
Method Summary
Modifier and TypeMethodDescriptiondoubleTheAverage Component Dependency (ACD)of the components.intTheCumulative Component Dependency (CCD)of the components.doubleTheNormalized Cumulative Component Dependency (NCCD)of the components.doubleTheRelative Average Component Dependency (RACD)of the components.toString()
-
Method Details
-
getCumulativeComponentDependency
TheCumulative Component Dependency (CCD)of the components.- See Also:
-
getAverageComponentDependency
TheAverage Component Dependency (ACD)of the components.- See Also:
-
getRelativeAverageComponentDependency
TheRelative Average Component Dependency (RACD)of the components.- See Also:
-
getNormalizedCumulativeComponentDependency
TheNormalized Cumulative Component Dependency (NCCD)of the components.- See Also:
-
toString
-