Step by step UML modeling Series 3. Use Case diagram)

Source: Internet
Author: User
Document directory
  • The UML use case diagram contains three relationships: (include), (extend), and (generalization ).
Overview

The Use Case attempts to summarize the relationship between roles and systems in the use case, and describes the functional requirements of the system, the interaction between roles and systems, and the system response.

Official definition: Use Cases define a set of use cases, each of which is a series of operations performed by the system. These operations generate values that can be observed by specific protagonists.

Simple statement:Use CasesIt is a set of activities that interact with participants and provide them with observability results.Use CasesIt is one thing that requires a series of activities to be completed. There are many different ways and steps to do one thing, it may also encounter various unexpected situations. Therefore, this event is composed of a set of many different situations, which is called the case scenario in UML. A use case scenario isUse Cases.

Use Case features

1. Use Cases are relatively independent, that is, they do not interact with other use cases, but complete the goal of the participants alone.

2. The execution results of use cases are Observability and meaningful for participants. For example, there is an operation to automatically back up data before deletion in the system. The operation result is transparent to the participants. The participants are not directly beneficiaries, so they cannot be called use cases.

3. events must be initiated by one participant. No use cases without participants exist. Use cases should not be started automatically or other use cases should be started.

4. Use Cases must appear in the form of Dynamic Object phrases. For example, "drinking water" is a valid use case, while "drinking" is not.

Case Granularity

The granularity of use cases is determined by the Abstraction Level of modeling.

1. In the business modeling stage, the granularity of use cases is appropriate for each use case to indicate a complete thing.

2. In the conceptual modeling stage, the granularity of use cases is that each use case can describe a complete event stream.

3. In the system modeling stage, the granularity of use cases is that each use case can describe a complete interaction between the operator and the computer.

Mistakes in use cases and functions

Functions and use cases are essentially different.

1. The function exists without the user's desire. For example, the function of describing a bicycle is that it can ride and carry things, and no one will use it.

2. functions are isolated. In the system, an output can be obtained by giving an input. The use case is a systematic task, and the work of this system is very clear to reach a specific goal for a participant.

3. If you need to explain the use cases from the perspective of functions, the use cases can be interpreted as a series of combinations of functions to accomplish a specific goal.

The UML use case diagram contains three relationships: (include), (extend), and (generalization ).

1. Inclusion relationship: Use Inclusion cases to encapsulate a group of similar actions (behavior fragments) that span multiple use cases, so that multiple Base use cases can be reused. The relationship between the basic case control and the contained case, and whether the event stream of the included case will be inserted into the event stream of the base case. The base use case can depend on the result of the execution of the use case, but neither party can access the attributes of the other party.
The inclusion relationship is reused for a typical application, that is, the scenario described in the definition. However, when an event in a use case flows through a complex process, we can abstract an event stream into an included use case to simplify the description of the use case. On the contrary, when the use cases are too detailed, a basic use case can be abstracted to include these fine-grained use cases. This is similar to encapsulating an algorithm of a program into a sub-process in a process design language, and then calling this sub-process from the main program.

For example, an administrator can manage articles by adding, modifying, and deleting functions.

2. Extended)

Extensioning: encapsulate a relatively independent and optional action in the base case with the Extension case, and then let it claim the Extension Point from the base case) to make the basic use case behavior more concise and more concentrated. 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 points in the base use case. However, the extended use case is invisible to the base use case.

For an extension case, there are several extension points on the base case.

For example, after the Administrator submits an application, he can print the application form and view the application form.

4. generalization)

General relationship: the child case is similar to the parent case, but shows more special behavior. The child case inherits all structures, behaviors, and relationships of the parent case. A child use case can use a behavior of the parent use case or reload it. The parent case is usually abstract. Generalization is rarely used in practical applications. Special behaviors in subcases can be used as alternative streams in the parent case.

 

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:
1. Unconditional occurrence: yes;
2. Conditional occurrence: The occurrence may not occur. 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.

 

Finally, we will present an example of a use case diagram.

 

You are welcome to participate in the discussion. If you find it helpful, please clickRecommended. Thank you very much.

Author: spring yang

Source: http://www.cnblogs.com/springyangwc/

The copyright of this article is shared by the author and the blog Park. You are welcome to repost this article. However, you must retain this statement without the author's consent and provide a clear link to the original article on the article page. Otherwise, you will be held legally liable.

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.