Relationship between use case diagram, class diagram, and sequence diagram

Source: Internet
Author: User

Class diagrams and sequence diagrams are directly associated with program code in software system design. To be precise, program code is directly generated by class diagrams, A Sequence Chart can define a class chart method. The use case diagram is used to describe system functions and has no direct relationship with the sequence diagram.

A class diagram consists of three parts in UML, as shown in. It represents the class name, class attributes, and class methods respectively.

When defining a class, you must provide the class name, attributes, and methods. methods can also be defined in the sequence diagram, and a message is defined in the method, A method is automatically added to the corresponding class diagram. However, when you modify or delete a message defined in the sequence diagram, the methods in the corresponding class diagram are not automatically modified or deleted.

For example, the student registration business can be described using the following class diagram and sequence diagram.

1. use case diagram
 

2. Class Diagram


The register class has a method of inputstudents (). The student class has two methods: addnewstudent () and modifyregisterdate (). Each method corresponds to the message in the time sequence diagram.
 

3. Time Sequence Diagram


If the message passing arrow points to the object class, an identical method is automatically generated. If register points to the class, an inputstudents () method is automatically generated in the register class diagram, student has two arrows pointing to it, and the modifyregisterdate () and addnewstudent () methods are automatically generated in the student class.

 

To sum up, the three figures can be summarized as follows:

1. Each use case in the use case diagram (here it refers to the system use case rather than the business use case) should be presented in a sequence diagram;

2. the time sequence diagram must represent the links of all classes in the class diagram. If it is well performed, each line is expressed in a time sequence diagram;

3. Each message in the sequence diagram corresponds to the methods of each class in the class diagram.

To make the above three items perfectly match the use cases, classes, and time series in the three figures, it depends on the level and experience of each person.

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.