sequence diagram
sequence diagram is used to describe the time sequence of message transfer between objects, that is, the order of behavior in the use case.
When a use case is executed, each message in the sequence diagram corresponds to a class operation or a trigger that causes a conversion Event.
In UML, the sequence diagram is represented as a two-dimensional relationship diagram, where the vertical axis is the time axis, and the time extends downward along the vertical line. The horizontal axis represents each independent object in the collaboration. When the object exists, The lifeline is represented by a dashed line, and the message is represented by an arrow from the lifeline of one object to the lifeline of another object. The arrows are arranged up and down in the order of time.
ATM sequence diagram of successful user login
basic concepts in the sequence diagram
object : The object in the sequence diagram is represented by a rectangle, and the object name is underlined. Placing the object at the top of the sequence diagram indicates that the object already exists at the beginning of the interaction. If the position of the object is not at the top, it means that the object is in the process of interaction Z3z
lifeline: lifeline is a vertical dashed line. It means that the object in the sequence diagram exists in a certain life cycle. The bottom center of each object has a lifeline.
message: between two objects One-way communication from the sender to the receiver. The return message is rarely used in the sequence diagram.
activation: sequence diagram can describe the activation and passivation of an object. Activation means that the object is occupied to complete a task. Blunt Transformation means that the object is idle, waiting for a message. In UML, when the object is activated, the lifeline of the object is widened to a rectangle. The rectangle is called the planning bar or the control period. The object is activated at the top of the activation bar. The object is in It is passivated after completing its work. The creation and destruction of
objects: in the sequence diagram, the default position of the object is at the top of the diagram. This means that the object already exists before the interaction starts. If the object is in the interactive process If you want to revoke an object, place an "X" symbol at the end point of its lifeline.
Exercise: Sun Yat-sen's......
activity diagram
in UML, activity diagram Essentially it is a flowchart. It is used to describe the activities, decision points and branches of the system. The basic concepts in the
activity diagram
Action state: atomic, uninterruptible action, and after this action is completed to another action Transition. In UML, the action state is represented by a rounded rectangle, and the action represented by the action state is written inside the rounded rectangle.
branch and combine And: branching is very common in software systems. It is generally used to express the conditional behavior of the object class. The true or false of a Boolean expression is used to determine the flow of the action. The conditional behavior is expressed by branching and merging. In the activity diagram , The branch is represented by a small hollow diamond. The branch includes one in transition and two out transitions with conditions. The conditions of out transitions should be mutually exclusive, and it must be ensured that only one out transition can be triggered. The merge contains two in transitions with conditions Transition and a transition.
state diagram
state diagram: describes the dynamic behavior of the object over time by establishing the life cycle model of the object. The basic concept of
state diagram
state: is represented by a rounded rectangle. State name The name of the state, usually represented by a string. The name of a state should be unique in the context of the state diagram. Z3z
conversion: is represented by a straight line with an arrow. One end is connected to the source state, and the other end is connected to the target state.
Initial state: Each state diagram of has an initial state. This state represents the starting position of the state diagram. The initial state can only be used as the source of conversion, not as the target of conversion, and there can only be one in the state diagram. The initial state is represented by a solid circle.
end state: the final state of the model element, which is the end of a state diagramStop point. There can be multiple termination states in a state diagram.
collaboration diagram
collaboration diagram (also called cooperation diagram) is a kind of interaction diagram.
sequence diagram mainly focuses on the sequence of messages between objects in time. The collaboration diagram expresses the interaction process between objects and the association relationship between objects