Class VisibilityMetrics
java.lang.Object
com.tngtech.archunit.library.metrics.VisibilityMetrics
@PublicAPI(usage=ACCESS) public final class VisibilityMetrics extends java.lang.Object
Calculates visibility metrics as defined by Herbert Dowalil in his book
"Modulare Softwarearchitektur: Nachhaltiger Entwurf durch Microservices, Modulithen und SOA 2.0".
Visibility refers to the property, if an element of a component is accessible from outside of the component. An example would be a package, where public classes are visible from outside of the package, while package-private, protected and private classes are not. The metrics are calculated by introducing the following definitions:
Consider the following example:
Visibility refers to the property, if an element of a component is accessible from outside of the component. An example would be a package, where public classes are visible from outside of the package, while package-private, protected and private classes are not. The metrics are calculated by introducing the following definitions:
- Relative Visibility (RV):
num(visible_elements) / num(all_elements)
for each component - Average Relative Visibility (ARV): The average of all
RV
values - Global Relative Visibility (GRV):
num(visible_elements) / num(all_elements)
over all components
Consider the following example:
Component1 (Visible: 2 / Invisible: 4)
Component2 (Visible: 3 / Invisible: 3)
Component3 (Visible 1 / Invisible: 9)
ThenRV(Component1) = 2 / 6 = 0.33
RV(Component2) = 3 / 6 = 0.5
RV(Component3) = 1 / 10 = 0.1
ARV = (0.33 + 0.5 + 0.1) / 3 = 0.31
GRV = 6 / 22 = 0.27
.-
Method Summary
Modifier and Type Method Description double
getAverageRelativeVisibility()
TheAverage Relative Visibility (ARV)
of the components.double
getGlobalRelativeVisibility()
TheGlobal Relative Visibility (GRV)
of the components.double
getRelativeVisibility(java.lang.String componentIdentifier)
TheRelative Visibility (RV)
of the component.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
getRelativeVisibility
TheRelative Visibility (RV)
of the component.- See Also:
VisibilityMetrics
-
getAverageRelativeVisibility
TheAverage Relative Visibility (ARV)
of the components.- See Also:
VisibilityMetrics
-
getGlobalRelativeVisibility
TheGlobal Relative Visibility (GRV)
of the components.- See Also:
VisibilityMetrics
-