Static analysis metrics for analyzing UML model

This content applies to version 7.5.4 or later. You can collect several types of statistical information about a UML model to help you analyze it. For example, you can discover the number of diagrams, the number of classes in a package, or the depth of a classifier in its inheritance hierarchy. UML metrics are grouped into four categories: coupling, diagrams, inheritance, and size.

Coupling metrics

The following table lists the metrics in the coupling category:
Metric name Description
Abstractness This metric calculates the ratio of abstract and interface classes to the total number of classes in the package.
Afferent coupling This metric counts the number of classifiers outside a package that reference a classifier inside the package. During the analysis, the following items are examined: incoming inheritance relationships, incoming dependency relationships, attributes, and operation parameters. The parent nodes show the average of the results for the child nodes.
Efferent coupling This metric counts the number of classifiers in a different package that a classifier inside a package references. During the analysis, the following items are examined: outgoing inheritance relationships, outgoing dependency relationships, attributes, and operation parameters. The parent nodes show the average of the results for the child nodes.
Instability This metric calculates the ratio of efferent coupling to the total coupling (afferent plus efferent).
Normal distance This metric calculates the normalized distance to the main sequence. The main sequence is where abstractness and instability are balanced.

Diagram metrics

The following table lists the metrics in the diagram category:
Metric name Description
Number of diagrams in a namespace This metric counts the number of diagrams in a namespace. The parent nodes show the sum of the results for the child nodes.
Number of edges in a diagram This metric counts the number of edges in a diagram. The parent nodes show the sum of the results for the child nodes.
Number of shapes in a diagram This metric counts the number of shapes in a diagram. The parent nodes show the sum of the results for the child nodes.

Inheritance metrics

The following table lists the metrics in the inheritance category:
Metric name Description
Number of ancestors of a classifier This metric counts the classifiers that a classifier specializes. The parent nodes show the average of the results for the child nodes.
Number of descendants of a classifier This metric counts the classifiers that a classifier generalizes. The parent nodes show the average of the results for the child nodes.
Depth of a classifier in the hierarchy This metric determines the depth of a classifier in its inheritance hierarchy; that is, the number of generalizations in the deepest inheritance branch. The parent nodes show the average of the results for the child nodes.
Number of attributes that a classifier inherits This metric counts the number of attributes in the generalization classifiers of a classifier that the classifier does not override. The parent nodes show the average of the results for the child nodes.
Number of operations that a classifier inherits This metric counts the number of operations in the generalization classifiers of a classifier that the classifier does not override. The parent nodes show the average of the results for the child nodes.
Number of attributes that a classifier overrides This metric counts the number of attributes in the generalization classifiers of a classifier that the classifier overrides. The parent nodes show the average of the results for the child nodes.
Number of operations that a classifier overrides This metric counts the number of operations in the generalization classifiers of a classifier that the classifier overrides. The parent nodes show the average of the results for the child nodes.
Number of interfaces that a class implements This metric counts the number of interfaces that a class implements. The parent nodes show the sum of the results for the child nodes.

Size metrics

The following table lists the metrics in the size category:
Metric name Description
Average number of attributes per classifier This metric counts the average number of attributes that a classifier defines, but does not include inherited attributes. The parent nodes show the average of the results for the child nodes.
Average number of classifiers per package This metric counts the average number of classifiers in a package. The parent nodes show the average of the results for the child nodes.
Average number of operations per classifier This metric counts the average number of operations that a classifier defines, but does not include inherited operations. The parent nodes show the average of the results for the child nodes.
Average number of operations per classifier whose names start with "get", "is," or "has" This metric counts the average number of getters that a classifier defines, but does not include inherited getters. A getter is a method that returns the value of a property that a classifier defines. The name of a getter method either begins with the prefix get, which returns a non-Boolean value of a property; is, which returns a Boolean property; or has, which indicates that a property that is a collection of items contains a certain value. The parent nodes show the average of the results for the child nodes.
Average number of operations per classifier whose names start with "set" This metric counts the average number of setters that a classifier defines, but does not include inherited setters. A setter is a method that sets the value of a property that a classifier defines. The name of a setter method begins with the prefix set. The parent nodes show the average of the results for the child nodes.
Average number of parameters per operation This metric counts the average number of parameters that an operation has. The parent nodes show the average of the results for the child nodes.
Number of attributes in a classifier This metric counts the total number of attributes that a classifier defines, but does not include inherited attributes. The parent nodes show the sum of the results for the child nodes.
Number of operations in a classifier This metric counts the total number of operations that a classifier defines, but does not include inherited operations. The parent nodes show the sum of the results for the child nodes.
Number of operations in a classifier whose name starts with "set" This metric counts the total number of setters that a classifier defines, but does not include inherited setters. A setter is a method that sets the value of a property that a classifier defines. The name of a setter method begins with the prefix set. The parent nodes show the sum of the results for the child nodes.
Number of operations in a classifier whose name starts with "get", "is," or "has" This metric counts the total number of getters that a classifier defines, but does not include inherited getters. A getter is a method that returns the value of a property that a classifier defines. The name of a getter method either begins with the prefix get, which returns a non-Boolean value of a property; is, which returns a Boolean property; or has, which indicates that a property that is a collection of items contains a certain value. The parent nodes show the sum of the results for the child nodes.
Number of classifiers in a package This metric counts the total number of classifiers in a package. The parent nodes show the sum of the results for the child nodes.
Number of parameters in an operation This metric counts the total number of parameters that an operation has. The parent nodes show the sum of the results for the child nodes.

Feedback