A class ( English class ) is a model element in the Unified Modeling Language (UML), a modeling language for software and other systems. It describes a number of versions with the same characteristics , the same restrictions and the same semantics .
A class is a type . It has a list of features , especially attributes and operations , as well as ports and signal receiver . In addition, it can have a list of inner classes . Inner classes are classes that are defined in the namespace of the class itself.
Types of classes
The UML differentiates between active and passive classes. All instances of active classes are active objects , that is, objects that “have a life of their own”. Immediately when an instance of an active class is created, a behavior specified for the class starts . This behavior continues until it is explicitly stopped or until the object is destroyed. Only active classes can have signal receivers .
An active class is drawn with double left and right margins.
Abstract classes are classes of which no copies can be created. Abstract classes look like normal classes in UML. To distinguish them, the word
abstractin curly brackets is placed below the class name . Alternatively, the class name can also be written in italics if this is easy to recognize.
In the UML, each class is also a namespace . On the one hand, this ensures that attributes and operations belonging to a class only need to have a unique name in the area of this class. Two attributes that belong to different classes can certainly have the same name. On the other hand, the metamodel of the UML allows also characterized that a class called nested classes (engl. Nested classes ) may possess. However, the UML specification does not contain any information on how nested classes are represented graphically in a class diagram .
In software development, for example in the Java programming language , the concept of inner classes is known . Nested classes in the sense of UML correspond to static inner classes in Java.
Classes are shown in class diagrams. The following three figures show three variants of the graphical notation for a class. Depending on whether a class is drawn on a class diagram for a design or analytical model, more or less detail can be shown.
Differences to UML 1.4
As of version 2.0 of the UML, classes can have inner classes.
In contrast to UML 1.x, there is no longer a model element attribute in UML2. Attributes of a class are reclassified as properties (Engl. Property ) models. This approach was introduced so that the UML2 metamodel can uniformly model attributes of a class as well as the ends of associations as properties.