The three relationships in the use case diagram include, extended, and generalized.

Source: Internet
Author: User

Labels: soft test UML object-oriented

An important way for users to communicate with developers is to describe user requirements. Developers can understand the functions of the system from the perspective of users.

A Use Case chart has three main elements: the participant (actor), the use case, and the relationship between objects in the use case chart. The contained and extended links are exclusive in the use case diagram, and the generalization exists in other class diagrams.

Include: When you can extract public behaviors from two or more use cases, you should use the include relationship to represent them. The extracted public use case becomes an abstract use case, and the original use case becomes a basic or basic use case. <Include> is the constructor of the Inclusion relationship. The arrow points to the abstract use case.

For example, in the data room charging system, "register student information" and "recharge" both require the operator or administrator to log on. Therefore, an abstract Use Case "User Login" can be defined ". The Relationship Between the use case "register student information" and "recharge" and the use case "User Login" is the inclusion relationship.

Sometimes when an event in a use case flows through a complex process, to simplify the description of the use case, we can also abstract a base use case to include these granular use cases.


Purpose: when multiple use cases need to use the same event stream, it is abstracted as a Public Use Case to avoid repeated descriptions of this event stream in multiple use cases, it can also prevent inconsistencies in the descriptions of the stream in different use cases during this time period. When you need to modify this public requirement, you only need to modify one use case to avoid inconsistent and repetitive work caused by modifying multiple use cases at the same time. In addition, when an event in a use case flows through a complex process, an event stream can be abstracted into an included use case to simplify the description of the use case.

2. Extended relationships

If a use case is obviously mixed with two or more different scenarios, multiple branches may occur as needed, this case can be divided into one basic case and one or more extension cases, which may make the description clearer. Add new behaviors for the extended use case. The extended use case can access the attributes of the base use case. Therefore, it can determine whether to execute itself based on the current status of the extension point in the base use case. The extended use case is invisible to the base use case. If an error or update is found during the "maintain student information" Operation in the IDC charging system, use the "Modify student information" case to complete the update, therefore, the relationship between the use case "querying records on the machine" and "exporting excel" is an extended relationship. <Extend> is the constructor of the extended relationship. The arrow points to the basic use case.

Links and differences between include links and extended relationships

Contact: All common information is extracted from existing use cases. As a separate use case, this public use case is reused through different methods, to reduce the workload of model maintenance.

Difference: when the basic stream of the basic use case in the extension relationship is executed, the extension use case is not necessarily executed, that is, the extension use case is executed only when the basic use case meets certain conditions.

When the basic stream execution of a basic use case in a link is included, the included use case will certainly be executed.

3. Generalization

When multiple use cases share a similar structure and behavior, they can be abstracted as parent use cases, and other use cases can be used as subuse cases of generalization relationships. In the general relationship of a use case, a subuse case is a special form of the parent case. It inherits all the structures, behaviors, and relationships of the parent case. The arrow points to the parent case. If you are registered in the IDC charging system, you can register locally or online. Then

Use case diagram as shown in Figure

Similarly, there is a general relationship between users, operators, and administrators.

Transformation: differences between extension and generalization in UML

Generalized representation is similar to the OO term "inheritance" or "polymorphism ". The Use Case generalization process in UML abstracts the merged parts of different use cases into independent parent use cases, and separately merges the unmerged parts into their respective subuse cases; the process of inclusion and extension is similar to that of generalization, but the optimization focus on the relationship between use cases is different. As follows:
● Generalization focuses on the mutual exclusion between subcases;
● Include focuses on the indirect nature of included use cases to provide services to actor;
● Extension focuses on the trigger uncertainty of the extension case. The details are as follows:


Since the use case is a UML representation of the system to provide services, the process of service is inevitable in all use case scenarios. However, the occurrence conditions can be divided into the following two situations:
Condition occurs unconditionally: Yes;
Conditional occurrence of a token: It may not occur, and the occurrence or failure depends on the system status;

Therefore, for the three relationships of use cases, combined with system status considerations, generalization and inclusion of use cases are unconditional use cases, and extension is conditional use cases. Furthermore, the use cases provide services for actor, but the use cases provide services in two ways: indirect and direct. Based on this, the generalized sub-cases provide direct services, the included use cases provide indirect services. Similarly, extended use cases provide direct services, but the occurrence of extended use cases is conditional.

In addition, the subuse cases in generalization and the extended use cases in extension can be used as the backup selection stream of basic Use Case events.

The three relationships in the use case diagram include, extended, and generalized.

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.