How is a static class or call to a static function presented in Sequence Diagram? As per my understanding, the lifeline belongs to an instance/object of a class. This article says metaclass stereotype can be used.
Class (i.e. static) methods and fields are indicated by underlining. Constant (i.e. final) fields are indicated via naming convention: constants should be in ALL_CAPS.
Sequence diagrams are appropriate to represent function calls, and you can specify the parameters and returned values as well. Save this answer. Show activity on this post. Communication Diagrams are also an option and tend to go into more detail with regards to parameters used within function calls.
Calling Static FunctionIt is invoked by using the class name. For example: Math. sqrt(a); //calling the square root function of the Math class.
There are two kinds of object models: dynamic and static. Dynamic models, such as UML interaction diagrams (sequence diagrams or communication diagrams), help design the logic, the behavior of the code or the method bodies. They tend to be the more interesting, difficult, important diagrams to create.
"In case of doubt, use comments, or stereotypes..."
Sequence Diagram:
+-------------+ +-------------------+
| <<class>> | | <<class>> |
| Cat | | FastFoodTerminal |
+------+------+ +---------+---------+
| |
| <<static>> |
| TurnOn() |
+--------------------------->+---+
| | |
+<---------------------------+<--+
| |
| Answer = |
| DoYouHaveCheeseBurger() |
+--------------------------->+---+
| | |
+<---------------------------+<--+
| |
Class Diagram:
+-------------------------------------------------+
| <<class>> |
| FastFoodTerminal |
+-------------------------------------------------+
| [+] void: FastFoodTerminal(); <<constructor>> |
| [#] int: ObtainMoneyDifference(); |
| [+] void: ReceiveMoney(); |
| [+] void: ReturnChange(); |
| [+] FastFoodTerminal: TurnOn(); <<static>> |
+-------------------------------------------------+
In this example, the "TurnOn()" is an static method that returns, an instance (object) of the "FastFoodTerminal" 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