In UML, the implementation of use cases is specified and described using an interactive diagram. The interaction diagram shows the relationship between objects and the messages processed between objects to model the dynamic characteristics of the system. There are two types of interaction diagrams: sequence diagram and collaborative diagram. The emphasis is different, but the semantics is equivalent and can be converted to each other. This section only describes the sequence diagram.
A sequence diagram is a time series interaction diagram that emphasizes messages. It consists of class roles, lifeline, activation period, and messages.
Class role(Class role)
Represents the role of an object in a sequence chart in interaction. It can be an actor or an object ). In UML, the operator is represented as a small humanoid, and the object is represented as a rectangle, where the object name is underlined.
Lifeline(Lifeline)
Indicates the existence of objects in a sequence chart over a period of time. In UML, messages are represented by labeled arrows in a sequence diagram.
Activation period(Activation)
Represents the period in which objects in the sequence chart perform an operation. In umlk, the lifeline is represented by a dotted line.
Message(Message)
Defines the classes for information exchange in interaction and collaboration, used to model the communication content between entities. In UML, the activation period is represented by a thin rectangle.
Now let's take the recharge function in the "Data room Charging System" as an example.
1. Search for roles:
1. Operator
Ii. Search for objects:
1. interface.
2. operations at the business layer should also be processed by objects.
3. Database
3. Interaction between objects and roles:
1. The operator enters the recharge interface.
2. The operator enters the card number
3. The operator sends the recharge command through the interface
4. The system checks whether the format of the card number is correct.
5. The system queries the existence of the database verification card number.
6. If the card number exists, the system prompts you to enter the recharge amount.
7. Enter the amount and click "OK ".
8. The system adds the recharge information to the database.
9. Display recharge success Information
Iv. Final sequence diagram: