Open Pandora's magic box-software design process (3)-Use Cases

Source: Internet
Author: User
Use Cases

In the previous chapter, we have found the stakeholders of the Pandora box system. Next, let's look at what they can do.

Let's see what players can do first? Based on the previous introduction, we can see that the most important thing players can do is to draw a lottery ". After the prize is drawn, the prize is obtained in the prize bag. The following is a summary:

Player use case:

Lottery;
Take Prize;

If you want to draw a lottery, you must first see the prize before drawing it. Therefore, the player case contains another prize, that is, the Pandora magic box. The same is true for a prize. You have to open the prize bag and take a look at it. The following figure shows the use case list:

Player use case:

View Pandora magic box;
Lottery;
View prize bags;
Take Prize;

I mentioned this in the first section:In the end, there will be a person born to win the grand prize, all the prizes in one breath. This kind of behavior is called "Bao Yuan". That is to say, there will be a special situation in the lucky draw case. Use Cases are as follows:

Player use case:

View Pandora magic box;
Lottery;
□Circle;
View prize bags;
Take Prize;

The most intuitive description of use cases is the UML use case diagram ). We will plot the above case as an example, as shown in 1:

 

 

(Figure 1) player Cases

 

 

A lottery use case is a key use case. This use case "Extended (extend)" generates a "circle" use case. Note that the extension is used instead of "include )". As shown in 2, what is the difference between expansion and include arrows?

 

(Figure 2) What is the difference between expansion and inclusion?

 

 

Take the ATM system as an example. The ATM system has a withdrawal case. If you want to withdraw money, you can first query the balance or directly withdraw money without querying. However, you must enter the withdrawal amount before you can withdraw money. The example is shown below:

 

 

(Figure 3) Differences Between Expansion and inclusion

 

 

"Query balance" is optional for "withdrawal operation. "Enter withdrawal amount" is required for "withdrawal operation! Otherwise, the system cannot know how much the user needs to pay? That is, you can use an extended arrow to connect to dispensable operations. You must use an included arrow to connect all operations.

Well, we can continue to draw examples of GM and timer. Here I won't draw that detail. 4. Figure 5:

 

 

(Figure 4) GM use case

 

 

(Figure 5) timer use case

 

 

Design misunderstandings

I have seen examples like this, as shown in 6:

 

(Figure 6) Incorrect case design

 

Figure 6 may be exaggerated. From the perspective of the use case chart, there is no problem with this chart. But it is indeed an incorrect use case chart! Because it involves all the system use cases at a level. This is like putting all functionsCodeAre written in a class file. For a large class file, we need to refactor it! After reading the code, you can divide the function into several modules and put them in different code files to clarify the code hierarchy (or relationship ). Why not design? The design also needs to be hierarchical. The mistake in Figure 6 is that it does not reflect the hierarchy of the design, and the problems at different levels are mixed together for thinking. The results of such a way of thinking can be imagined. The correct method is shown in Figure 7:

 

 

(Figure 7) hierarchy of Design

 

 

Let's first tell the readers about the general use cases that players will have. Then, we dive into the arena system and the escort system to illustrate the specific use cases in these two systems. 8. Figure 9:

 

 

(Figure 8) arena system use cases

 

 

(Figure 9) Escort System Use Cases

 

 

This is like a business trip to Hangzhou, where you stayed at the York Hotel in Xihu District. You can't stand on the street of chang'an Street in Beijing and ask a person like this: "Hi, sister-in-law, how can I go to the York Hotel in Xihu District, Hangzhou ?". You must have thought: first fly to Hangzhou Xiaoshan Airport, then let's talk about it. When you arrive at Xiaoshan Airport, you will first ask how to get to Xihu District? After arriving in Xihu District, you will ask the road man how to get to the York Hotel? So is life, code, design, and XXX ......

In the Pandora box system introduction, we initially obtained the "Business Object" in the "business model". Now we use the use case to get the "business behavior" in the "business model ". This will lay the foundation for our subsequent design steps.

 

 

 

 

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.