UML2 Metrics
|
Context |
Metric |
Description |
Model |
AGvsC |
Ratio between number of aggregations and number of classes in the model. |
Model |
ANA |
Average number of ancestors of all classes in the model. |
Model |
ASvsC |
Ratio between number of associations and number of classes in the model. |
Model |
ATvsCC |
Ratio between number of attributes and number of classes in the model. |
Model |
DEPvsC |
Ratio between number of class dependencies and number of classes in the model. |
Model |
GEvsC |
Ratio between number of inheritance relations and number of classes in the model. |
Model |
MaxDIT |
Maximum of all depths of inheritance trees. |
Model |
MaxHAgg |
Maximum of aggregation trees. |
Model |
NACM |
Number of all ancestors of all classes in the model. |
Model |
NACTM |
Number of attributes with class type in the model. |
Model |
NAGM |
Number of aggregations in the model. |
Model |
NASM |
Number of associations in the model. |
Model |
NATM |
Number of attributes whithin classes of the model. |
Model |
NCM |
Number of classes in the model. |
Model |
NDEPM |
Number of class dependencies in the model. |
Model |
NIH |
Total number of inheritance hierarchies in the model. |
Model |
NIM |
Number of inheritance relations in the model. |
Model |
NNOEM |
Number of navigable owned association ends in the model. |
Model |
NOM |
Number of operations whithin classes of the model. |
Model |
NPM |
Number of packages in the model. |
Model |
NTDM |
Number of class type dependencies in the model. |
Model |
OvsC |
Ratio between number of operations and number of classes in the model. |
Model |
TNME |
Total number of elements in the model. |
Package |
A |
Ratio between number of abstract classes and number of classes within the package. |
Package |
AHF |
Attribute hiding factor. |
Package |
AIF |
Attribute inheritance factor. |
Package |
ANDOCP |
Average number of other package's class usages by classes within the package. |
Package |
Ca |
Afferent coupling. |
Package |
Ce |
Efferent coupling. |
Package |
DNH |
Depth in the nesting hierarchy. |
Package |
H |
Relational cohesion. |
Package |
I |
Ratio between efferent coupling and total coupling (instability). |
Package |
NACP |
Number of abstract classes within the package. |
Package |
NAETOP |
Number of internal navigable owned association ends typed by classes in other packages. |
Package |
NAGGR |
Number of aggregation relationships within the package. |
Package |
NAP |
Number of associations within the package. |
Package |
NATIP |
Number of inherited attributes in classes within the package. |
Package |
NATP |
Number of attributes within the package. |
Package |
NAVCP |
Ratio between number of associations and number of classes within the package. |
Package |
NCAP |
Number of classes and associations within the package. |
Package |
NCP |
Number of classes within the package. |
Package |
NDCOP |
Number of dependencies of classes in other packages on classes within the package. |
Package |
NDOCP |
Number of dependencies of classes within the package on classes in other packages. |
Package |
NEACP |
Number of attributes in external classes typed by classes within the package. |
Package |
NEAECP |
Number of external navigable owned association ends typed by classes within the package. |
Package |
NESUBP |
Number of external classes which are direct subclasses of classes within the package. |
Package |
NESUPP |
Number of external classes which are direct superclases of classes within the package. |
Package |
NETAP |
Number of attributes within the package typed by classes in other packages. |
Package |
NIAEP |
Number of internal navigable owned association end types within the package. |
Package |
NIATP |
Number of internal attribute class types within the package. |
Package |
NICRP |
Number of internal relationships between classes within the package. |
Package |
NIGP |
Number of internal generalization relationships within the package. |
Package |
NIP |
Number of interfaces within the package. |
Package |
NIRP |
Number of interface realizations within the package. |
Package |
NITRP |
Number of internal class type relationships within the package. |
Package |
NIUP |
Number of interface usages within the package. |
Package |
NNPATP |
Number of non-public attributes within the package. |
Package |
NNPOP |
Number of non-public operations within the package. |
Package |
NOP |
Number of operations within the package. |
Package |
NOPIP |
Number of inherited operations in classes within the package. |
Package |
NOPP |
Number of other packages in the model. |
Package |
NPP |
Number of nested packages inside the package. |
Package |
NTCTP |
Number of times classes within the package are used as types from outside the package. |
Package |
NTTCP |
Number of times classes within the package use classes in other packages as type. |
Package |
OHF |
Operation hiding factor. |
Package |
OIF |
Operation inheritance factor. |
Package |
R |
Number of relationships between classes and interfaces within the package. |
Package |
TC |
Total coupling. |
Package |
TNATP |
Total number of attributes in classes within the package. |
Package |
TNOPP |
Total number of operations in classes within the package. |
Class |
APOC |
Average number of parameters in all operations within the class. |
Class |
CBC |
Number of attributes and associations with class type (coupling between classes). |
Class |
DAC |
Number of attributes that have another class as type. |
Class |
DAC2 |
Number of different classes that are used as attribute type. |
Class |
DAM |
Ratio between number of private and protected attributes and number of attributes. |
Class |
ECAtt |
Number of times the class is externally used as attribute type. |
Class |
ECPar |
Number of times the class is externally used as parameter type. |
Class |
ICPar |
Number of parameters within the class having another class or interface as type. |
Class |
ICParC |
Number of parameters within the class having another class as type. |
Class |
ICParI |
Number of parameters within the class having another interface as type. |
Class |
HAgg |
Length of the longest path to the leaves in the aggregation hierarchy. |
Class |
MaxDITC |
Depth of Inheritance Tree (maximum due to multiple inheritance). |
Class |
NAI |
Number of attributes visible to subclasses (public and protected). |
Class |
NAPTC |
Number of attributes with primitive type within the class. |
Class |
NASC |
Number of association with other classes or itself. |
Class |
NASOC |
Number of associations with other classes. |
Class |
NASSC |
Number of associations with itself. |
Class |
NATC |
Number of attributes within the class. |
Class |
NCATC |
Number of constant attributes within the class. |
Class |
NDPC |
Number of direct part classes which compose a composite class. |
Class |
NEATC |
Number of equal attributes with other classes. |
Class |
NFEAC |
Number of features within the class (attributes and operations). |
Class |
NOPC |
Number of operations within the class. |
Class |
NPARC |
Number of parameters in all operations within the class. |
Class |
NPPAC |
Number of private and protected attributes within the class. |
Class |
NPRIAC |
Number of private attributes within the class. |
Class |
NPROAC |
Number of protected attributes within the class. |
Class |
NPUBAC |
Number of public attributes within the class. |
Class |
NSUBC |
Number of direct child classes of the class. |
Class |
NSUBC2 |
Number of all children of the class. |
Class |
NSUPC |
Number of direct parent classes of the class. |
Class |
NSUPC2 |
Total number of ancestors of the class. |
Operation |
NEIPO |
Number of equal input-parameters in sibling operations. |
Operation |
NINPO |
Number of in-parameters within the operation. |
Operation |
NINPPO |
Number of input-parameters within the operation. |
Operation |
NIOPO |
Number of inout-parameters within the operation. |
UML2 Smells
|
Smell |
Description |
Attribute name overridden |
The model contains an attribute with the same name as an inherited attribute. |
Concrete Superclass |
The model contains an abstract class with a concrete superclass. |
Data Clumps (Attributes) |
The model contains classes with more than a specific number of equal attributes in sibling classes. |
Data Clumps (Parameters) |
The model contains operations with more than a specific number of equal input parameters in sibling operations. |
Equal Attributes in Sibling Classes |
Each sibling class of the owning class of an attribute contains an equal attribute. |
Extends |
The model contains a use case that extends another use case. |
Large Class |
The model contains a class owning more features (attributes and operations) than the specified limit. |
Long Parameter List |
The model contains an operation with more input parameters than the specified limit. |
Multiple Definition of Classes with Equal Names |
The model contains two classes (in different packages) having the same name. |
No Incoming |
The model contains a state without incoming transitions. |
Primitive Obsession (Constants) |
The model contains a class with more constant attributes than the specified limit. |
Primitive Obsession (Primitive Types) |
The model contains a class with more attributes having primitive types than the specified limit. |
Specialization Aggregation |
The model contains a generalization hierarchy between associations. |
Speculative Generality (Abstract Class) |
The model contains an abstract class that is inherited by one single class only. |
Speculative Generality (Interface) |
The model contains an interface that is implemented by one single class only. |
Unnamed Actor |
The model contains an actor without a name. |
Unnamed Attribute |
The model contains an attribute without a name. |
Unnamed Class |
The model contains a class without a name. |
Unnamed Data Type |
The model contains a data type without a name. |
Unnamed Interface |
The model contains an interface without a name. |
Unnamed Operation |
The model contains an operation without a name. |
Unnamed Package |
The model contains a package without a name. |
Unnamed Parameter |
The model contains a parameter without a name. |
Unnamed State |
The model contains a state without a name. |
Unnamed Use Case |
The model contains a use case without a name. |
Unused Class |
The model contains a class that has no child or parent classes, that is not associated to any other classes, and that is not used as attribute or parameter type. |
Unused Enumeration |
The model contains an enumeration whose literals are not used as any attribute types. |
Unused Interface |
The model contains an interface that is not specialized by another interface, and not realized or used by any classes. |
Unused Package |
The model contains a package without any contained elements. |
Unused Use Case |
The model contains a use case that is not associated to any actors. |
UML2 Refactorings
|
Refactoring |
Description |
Add Parameter |
An operation needs more information from its callers. Therefore,
this refactoring adds a parameter to an operation. |
Create Associated Class |
This refactoring creates an empty class and connects it with a new
association to the source class from where it is extracted. The multiplicities
of the new association is 1 at both ends. Usually, refactorings Move
Attribute and Move Operation are the next steps after this refactoring. |
Create Class with Attributes from Parameter List |
There is a group of parameters that naturally go together. This
refactoring creates a new class and inserts new attributes which conform to
the given parameter list. It is a part of refactoring Introduce Parameter Object. |
Create Subclass |
A class has features (attributes or operations) that are not used
in all instances. This refactoring creates a subclass for that subset of
features. However, the new subclass has no features. Usually, refactorings
Push Down Attribute and Push Down Operation are the next steps after
this refactoring. |
Create Superclass |
This refactoring can be applied when there are at least two classes
with similar features (attributes or operations). The refactoring creates a
superclass for this set of classes and is normally followed by refactorings
Pull Up Attribute and Pull Up Operation. So, the refactoring helps to
reduce the duplicate common features spread throughout different classes. |
Extract Class |
This refactoring extracts interrelated features (attributes and operations)
from a class to a new separated class. |
Extract Subclass |
There are features (attributes and operations) in a class required
for a special case only. This refactoring extracts a subclass containing this
features. |
Extract Superclass |
There are two or more classes with similar features. This refactoring
creates a new superclass and moves the common features to the
superclass. The refactoring helps to reduce redundancy by assembling
common features spread throughout different classes. |
Extract Superclass (without Pull Up Operation) |
This refactoring does the same as Extract Superclass but
moves only common attributes to the new superclass. |
Hide Attribute |
This refactoring hides a public class attribute by setting
its visibility to private and creates corresponding getter and setter operations. |
Inline Class |
There are two classes connected by a 1:1 association. One of them
has no further use. This refactoring merges these classes. |
Introduce Parameter Object |
There is a group of parameters that naturally go together. This
refactoring replaces a list of parameters with one object. This parameter
object is created for that purpose. |
Merge State Features |
This refactoring merges several features of two subsequent states
of a state chart (a contextual state and a parameter state). More specifically,
it moves all actions from the parameter state to the contextual state, redirects
all external transitions of the parameter state to the contextual state, and
finally removes all inner transitions in between both states. It is part of the
refactoring Merge States. |
Merge States |
This refactoring is used to form a set of states into a single one |
Move Attribute |
A property (attribute) is better placed in another class which
is associated to this class. This refactoring moves this property to the
associated class. |
Move Operation |
This refactoring moves an operation of a class to an associated
class. It is often applied when some class has too much behavior or when
classes collaborate too much. |
Pull Up Attribute |
This refactoring removes one property (attribute) from a class or
a set of classes and inserts it to one of its superclasses. |
Pull Up Operation |
This refactoring pulls an operation of a class to its superclass.
It is used internally on several classes which inherit from the
same superclass. The aim of this refactoring is often to extract identical
operations. |
Push Down Attribute |
An attribute (property) is used only by some subclasses. Move
the attribute to only these subclasses. More generally, this refactoring
moves the attribute to all subclasses. If it makes sense, the attribute
can be removed from some of these afterwards. Sometimes, it also makes
sense to keep an attribute in all subclasses to hide it from the superclass. |
Push Down Operation |
This refactoring pushes an operation from the owning class down
to all its subclasses. If it makes sense, the operation can be removed
from some of these afterwards. Sometimes, it also makes sense to keep an
operation in all subclasses to hide it from the superclass. |
Remove Empty Associated Class |
There is an empty class that is associated to another class. An
associated class is empty if it has no features except for possible getter
and setter operations for the corresponding association end. Furthermore,
it has no inner classes, subclasses, or superclasses, it does not implement
any interfaces, and it is not referred to as type of an attribute, operation
or parameter. |
Remove Empty Subclass |
A superclass has an empty subclass which shall be removed. This
class is not associated to another class. It has no features, no inner classes,
no further subclasses, and is not associated to other classes. It does not
implement any interfaces, and it is not referred to as type of an attribute,
operation or parameter. |
Remove Empty Superclass |
A set of classes has an empty superclass which shall be removed.
This class is not associated to another class. It has no features, no inner
classes, and is not associated to other classes. It does not implement any
interfaces, and it is not referred to as type of an attribute, operation or
parameter. |
Remove Isolated State |
This refactoring removes a state with no incoming or outgoing
transitions. |
Remove Parameter |
A parameter is no longer needed by an operation. Therefore,
this refactoring removes this parameter from the parameter list of the operation. |
Remove Redundant Transition |
This refactoring removes a transition between two states
of a state chart if there is already another one between the two states
similar to it. |
Remove Superclass |
There is a set of classes having a superclass that does not make
sense anymore. Remove this superclass after pushing remaining features
down. |
Remove Unused Interface |
This refactoring removes a given interface which is not used by
and not realized by any classifier and has no sub interface. |
Remove Unused Interfaces |
This refactoring removes all unused interfaces from the model. |
Rename Actor |
Renames an existing actor to the inserted new name. |
Rename Attribute |
Renames an existing class attribute to the inserted new name. |
Rename Class |
Renames an existing class to the inserted new name. |
Rename Operation |
Renames an existing operation to the inserted new name. |
Rename State |
Renames an existing state to the inserted new name. |
Rename Use Case |
Renames an existing use case to the inserted new name. |
Show Attribute |
This refactoring shows a private class attribute by setting
its visibility to public and removes corresponding getter and setter operations. |