The dynamic modeling mechanism of UML in standard modeling language

Source: Internet
Author: User

1. Message

In object-oriented technology, the interaction between objects is accomplished through the transfer of messages between objects. The concept of message is used in four dynamic models of UML. Typically, when an object invokes an operation in another object, a message pass is completed. When the operation is executed, the control is returned to the caller. objects cooperate through communication (messaging) with each other and constantly change their state according to the results of communication in their lifecycle.

In UML, the graphical representation of a message is to associate the sender and receiver of the message with a segment with an arrowhead, and the type of the arrow represents the type of message, as shown in Figure 2.

There are three kinds of message types defined by UML:

Simple messages represent simple flow of control. Used to describe how control passes between objects, regardless of the details of the communication.

Synchronous messages (synchronous message) represent a nested control flow. The call to the operation is a typical synchronization message. The caller must wait for the message to return after the message has been sent, and the caller can continue to perform its own operation only after the operation of the processing message has finished executing.

Asynchronous messages (asynchronous message) represent asynchronous control flows. The caller can continue to perform its own operation without waiting for the message to return after the message is sent. Asynchronous messages are primarily used to describe concurrent behavior in real-time systems.

2. State diagram

State Diagram is used to describe all possible states of a particular object and events that cause state transitions. Most object-oriented techniques use state diagrams to represent the behavior of a single object in its lifecycle. A statechart diagram consists of a series of states and transitions between states.

(1) State all objects have a state, which is the result of a series of activities performed by the object. When an event occurs, the state of the object changes. The states defined in the Statechart diagram are: Initial state, final state, intermediate state, and compound state. The initial states are the starting point of the state graph, and the final state is the endpoint of the statechart diagram. A state graph can only have one initial state, and the final states may have multiple.

The intermediate state consists of two regions: the Name field and the internal transfer field, as shown in Figure 3. The internal transfer field in the diagram is optional, and the listed actions are executed when the object is in that state, and the execution of the action does not change the state of the object.

A state can be further refined into multiple sub states, and we will be able to further refine the state called the composite state. There are "or relationships" and "relationship" relationships between child states. or relationship (Figure 4) shows that only one child state can be reached at a time. For example, a car in a running state has two different sub states of forward and backward in the compound state of "driving", in which the car either forwards or backwards. and relationships (Figure 5) show that multiple child states (called concurrent Child states) can be reached at a time at a time in a composite state. State diagrams with concurrent child states are called concurrent State diagrams.

(2) A connection with an arrowhead between states in a transfer state diagram is called a transfer. State transitions are usually triggered by events, and an event expression that triggers a transfer should be marked on the transfer. If an event is not marked on the transfer, the transfer is automatically triggered when the internal activity in the source state has finished executing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.