If I understand signal right this is an asynchronous message between two or more objects. For example in UML we have a signal classifier:
-----------------
| << signal >> |
| SomeEvent |
-----------------
|id:Int |
|text:String |
-----------------
|getId() |
|getText() |
-----------------
Then we can write this signal in Java as following:
class SomeEvent{
private final int id;
private final String text;
//+constructor + getters
}
However, in Java we have a CLASS, but in UML we have a SIGNAL classifier, but not a CLASS classifier(Update: I mean in this example). How to explain it?
Your discussion about UML signals is correct.
From the spec.:
10.3.3.1 Signals
A Signal is a specification of a kind of communication between objects in which a reaction is asynchronously triggered in the receiver without a reply. The receiving object handles Signals as specified by clause 13.3. The data carried by the communication are represented as attributes of the Signal. A Signal is defined independently of the Classifiers handling it.
However, in Java we have a CLASS, but in UML we have a SIGNAL classifier, but not a CLASS classifier. How to explain it?
11.4 Classes
... The purpose of a Class is to specify a classification of objects and to specify the Features that characterize the structure and behavior of those objects.
11.4.4 Notation
A Class is shown using the Classifier symbol. As Class is the most widely used Classifier, no keyword is needed to indicate that the metaclass is Class.
UML is programming-language-independent.
In Java, UML class and signal classifiers are implemented as classes.
Another example: UML has a interface classifier, but C++ does not have interfaces. An interface in C++ would be an abstract (pure virtual) class.
In fact UML is richer than Java. In UML, Signal, Class, Component, and Collaboration classifier concepts would correspond to Java Class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With