SDMetrics currently features the following UML design metrics. The metrics cover information collected from class, package, object, and composition structure diagrams, communication and sequence diagrams, statechart and activity diagrams, as well as use case, deployment, and component diagrams.
The list shows the metrics for UML2. The metrics for UML1.3/1.4 are largely the same, or have equivalent counterparts, where applicable. Click on the name of a metric for a more detailed description of the metric.
Class metrics | ||
Metric | Category | Description |
---|---|---|
NumAttr | Size | The number of attributes in the class. |
NumOps | Size | The number of operations in a class. |
NumPubOps | Size | The number of public operations in a class. |
Setters | Size | The number of operations with a name starting with 'set'. |
Getters | Size | The number of operations with a name starting with 'get', 'is', or 'has'. |
Nesting | The nesting level of the class (for inner classes). | |
IFImpl | Inheritance | The number of interfaces the class implements. |
NOC | Inheritance | The number of children of the class (UML Generalization). |
NumDesc | Inheritance | The number of descendents of the class (UML Generalization). |
NumAnc | Inheritance | The number of ancestors of the class. |
DIT | Inheritance | The depth of the class in the inheritance hierarchy. |
CLD | Inheritance | Class to leaf depth. |
OpsInh | Inheritance | The number of inherited operations. |
AttrInh | Inheritance | The number of inherited attributes. |
Dep_Out | Coupling (import) | The number of elements on which this class depends. |
Dep_In | Coupling (export) | The number of elements that depend on this class. |
NumAssEl_ssc | Coupling | The number of associated elements in the same scope (namespace) as the class. |
NumAssEl_sb | Coupling | The number of associated elements in the same scope branch as the class. |
NumAssEl_nsb | Coupling | The number of associated elements not in the same scope branch as the class. |
EC_Attr | Coupling (export) | The number of times the class is externally used as attribute type. |
IC_Attr | Coupling (import) | The number of attributes in the class having another class or interface as their type. |
EC_Par | Coupling (export) | The number of times the class is externally used as parameter type. |
IC_Par | Coupling (import) | The number of parameters in the class having another class or interface as their type. |
Connectors | Complexity | The number of connectors owned by the class. |
InstSpec | The number of instance specification where the class is a classifier. | |
LLInst | The number of lifelines that represent a property of which this class is the type. | |
MsgSent | Coupling (import) | The number of messages sent. |
MsgRecv | Coupling (export) | The number of messages received. |
MsgSelf | Complexity | The number of messages sent to instances of the same class. |
Diags | Diagram | The number of times the class appears on a diagram. |
Interface metrics | ||
Metric | Category | Description |
NumOps | Size | The number of operations in the interface. |
EC_Attr | Coupling (export) | The number of times the interface is used as attribute type. |
EC_Par | Coupling (export) | The number of times the interface is used as parameter type. |
IC_Par | Coupling (import) | The number of parameters in the interface having an interface or class as their type. |
Assoc | Coupling | The number of elements the interface has an association with. |
NumDirClients | The number of elements directly implementing the interface. | |
NumIndClients | The number of elements implementing a descendent of the interface. | |
NumAnc | Inheritance | The number of ancestors of the interface. |
NumDesc | Inheritance | The number of descendents of the interface. |
Diags | Diagram | The number of times the interface appears on a diagram. |
Package metrics | ||
Metric | Category | Description |
NumCls | Size | The number of classes in the package. |
NumCls_tc | Size | The number of classes in the package, its subpackages, and so on. |
NumOpsCls | Size | The number of operations in the classes of the package. |
NumInterf | Size | The number of interfaces in the package. |
R | Complexity | The number of relationships between classes and interfaces in the package. |
H | Cohesion | Relational cohesion. |
Ca | Coupling (export) | Afferent coupling. |
Ce | Coupling (import) | Efferent coupling. |
I | Instability or ease of change. | |
A | Abstractness (or generality) of the package. | |
D | Distance from the main sequence. | |
DN | Normalized distance D' from the main sequence. | |
Nesting | Nesting | Nesting level of the package in the package hierarchy. |
ConnComp | Cohesion | The connected components formed by the classes and interfaces of the package. |
Dep_Out | Coupling (import) | The number of UML dependencies where the package is the client. |
Dep_In | Coupling (export) | The number of UML dependencies where the package is the supplier. |
DepPack | Coupling (import) | The number of packages on which classes and interfaces of this package depend. |
MsgSent_Outside | Coupling (import) | The number of messages sent to instances of classes outside the package. |
MsgRecv_Outside | Coupling (export) | The number of messages received by classifier instances of classes outside the package. |
MsgSent_within | Complexity | The number of messages sent between classifier instances of classes in the package. |
Diags | Diagram | The number of times the package appears on a diagram. |
Interaction metrics | ||
Metric | Category | Description |
LifeLines | Size | The number of lifelines participating in the interaction. |
Messages | Complexity | The number of messages sent within the interaction. |
SelfMessages | The number of messages that objects in the interaction send to themselves. | |
CombinedFragments | Size | The number of combined fragments in the interaction. |
Operands | Size | The number of interaction operands of the combined fragments in the interaction. |
Height | The maximum number of messages on any of the lifelines of interaction. | |
CombinedFragmentNesting | The maximum nesting level of combined fragments in the interaction. | |
Usecase metrics
The following use case metrics are collected from use case diagrams. If use case details are described with activity or sequence diagrams, these diagrams can be used to better measure the size or complexity of the use cases. | ||
Metric | Category | Description |
NumAss | The number of associations the use case participates in. | |
ExtPts | The number of extension points of the use case. | |
Including | Coupling (import) | The number of use cases which this one includes. |
Included | Coupling (export) | The number of use cases which include this one. |
Extended | The number of use cases which extend this one. | |
Extending | The number of use cases which this one extends. | |
Diags | Diagram | The number of times the use case appears on a diagram. |
Statemachine metrics | ||
Metric | Category | Description |
Trans | Complexity | The number of transitions in the state machine. |
TEffects | Complexity | The number of transitions with an effect in the state machine. |
TGuard | Complexity | The number of transitions with a guard in the state machine. |
TTrigger | Complexity | The number of triggers of the transitions of the state machine. |
States | Size | The number of states in the state machine. |
SActivity | Size | The number of activities defined for the states of the state machine. |
CC | Complexity | The cyclomatic complexity of the state-transition graph. |
Activity metrics | ||
Metric | Category | Description |
Actions | Size | The number of actions of the activity. |
ObjectNodes | Size | The number of object nodes of the activity. |
Pins | Size | The number of pins on nodes of the activity. |
ControlNodes | Size | The number of control nodes of the activity. |
Partitions | Size | The number of activity partitions in the activity. |
Groups | Size | The number of activity groups or regions of the activity. |
ControlFlows | Complexity | The number of control flows of the activity. |
ObjectFlows | Complexity | The number of object flows of the activity. |
Guards | Complexity | The number of guards defined on object and control flows of the activity. |
ExcHandlers | Complexity | The number of exception handlers of the activity. |
Component metrics | ||
Metric | Category | Description |
NumOps | Size | The number of operations of the component. |
NumComp | Size | The number of subcomponents of the component. |
NumPack | Size | The number of packages of the component. |
NumCls | Size | The number of classes of the component. |
NumInterf | Size | The number of interfaces of the component. |
NumManifest | The number of artifacts of which this component is a manifestation. | |
Connectors | Complexity | The number of connectors owned by the component. |
ProvidedIF | Inheritance | The number of interfaces the component provides. |
RequiredIF | The number of interfaces the component requires. | |
Dep_Out | Coupling (import) | The number of outgoing UML dependencies (component is the client). |
Dep_In | Coupling (export) | The number of incoming UML dependencies (component is the supplier). |
Assoc_Out | Coupling (import) | The number of associated elements via outgoing associations. |
Assoc_In | Coupling (import) | The number of associated elements via incoming associations. |
Diags | Diagram | The number of times the component appears on a diagram. |
Node metrics | ||
Metric | Category | Description |
Type | The type of node (regular, execution environment, or device). | |
NumOps | Size | The number of operations of the node. |
NumComp | Size | The number of components located on the node. |
NumNodes | Size | The number of subnodes of the node. |
NumArt | Size | The number of artifacts deployed on the node. |
NumPack | Size | The number of packages of the node. |
AssEl | Coupling | The number of elements the node is associated with. |
Diags | Diagram | The number of times the node appears on a diagram. |
Diagram metrics
The following set of metrics may be useful if design diagrams are to be made the subject of reviews or inspections. | ||
Metric | Category | Description |
Type | The type of diagram (class diagram, sequence diagram, etc. | |
Elements | Size | The total number of design elements on the diagram. |
Classes | Size | The number of classes on the diagram. |
Interfc | Size | The number of interfaces on the diagram. |
Packages | Size | The number of packages on the diagram. |
Assoc | Complexity | The number of associations on the diagram. |
Genrs | Complexity | The number of generalizations on the diagram. |
Deps | Complexity | The number of UML dependencies and UML usage dependencies on the diagram. |
IfRealize | Complexity | The number of interface realizations on the diagram. |
InstSpec | Size | The number of instance specifications on the diagram. |
Lifelines | Size | The number of lifelines on the diagram. |
Connectors | Complexity | The number of connectors on the diagram. |
Messages | Complexity | The number of messages on the diagram. |
Actors | Size | The number of actors on the diagram. |
UseCase | Size | The number of use cases on the diagram. |
ExtPts | Size | The number of extension points on the diagram. |
Extends | Complexity | The number of use case extensions on the diagram. |
Includes | Complexity | The number of use case includes on the diagram. |