Class LakosMetrics
java.lang.Object
com.tngtech.archunit.library.metrics.LakosMetrics
@PublicAPI(usage=ACCESS) public final class LakosMetrics extends java.lang.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
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) = 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
CCD = 4 + 2 + 1 + 1 = 8
, ACD = 8 / 4 = 2
, RACD = 2 / 4 = 0.5
, NCCD = 8 / 8 = 1.0
-
Method Summary
Modifier and Type Method Description double
getAverageComponentDependency()
TheAverage Component Dependency (ACD)
of the components.int
getCumulativeComponentDependency()
TheCumulative Component Dependency (CCD)
of the components.double
getNormalizedCumulativeComponentDependency()
TheNormalized Cumulative Component Dependency (NCCD)
of the components.double
getRelativeAverageComponentDependency()
TheRelative Average Component Dependency (RACD)
of the components.java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Method Details
-
getCumulativeComponentDependency
TheCumulative Component Dependency (CCD)
of the components.- See Also:
LakosMetrics
-
getAverageComponentDependency
TheAverage Component Dependency (ACD)
of the components.- See Also:
LakosMetrics
-
getRelativeAverageComponentDependency
TheRelative Average Component Dependency (RACD)
of the components.- See Also:
LakosMetrics
-
getNormalizedCumulativeComponentDependency
TheNormalized Cumulative Component Dependency (NCCD)
of the components.- See Also:
LakosMetrics
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-