UML is a modeling specification
in the software industry, which can establish a requirement
model, a design model, an implementation model, and
a test model for software projects, because UML has
accurate modeling semantics and can be effectively
integrated between various models, so it can be simulated
and verified based on the model, so that the design
has complete forward-looking capabilities.
The latest UML specification
is 2.5, which has 13 types of diagrams, divided into
2 categories: static structure diagrams and dynamic
behavior diagrams. UML is more professional and abstract
to learn because of the accuracy of modeling, here
is a special snake game as an example to explain the
13 kinds of UML diagrams, as shown in the following
figure:
UML Diagram 1:
Use case diagram
Why do you need use case diagram
modeling
The use case diagram actually
comes from the scene description in the film field,
and it is an effective way for the director to tell
the actor about the movie script.
It was later referenced by Ivar,
the founder of UML, as a diagram to describe the user's
needs.
A use case diagram describes
what capabilities a system has from the user's perspective.
The user uses actor elements
to represent
The user uses usecase to describe
the usage scenario of the system.,
What are the benefits of a use
case diagram describing requirements?
This way the description of the
functional requirements is in line with the user's
perspective, and the user is easy to understand and
easy to participate in.
What is there in the use case
diagram
Any UML diagram has semantics,
elements, relationships, and uses, and the following
is a list of use case diagrams:
Semanteme |
Describe
the scenario in which the user uses the system |
Element |
Actor:
This can be an operator, an external system, an
external device Time.
Use case: A scenario description of the interaction
between the actor and the system. |
Relationship |
Between
Roles: Generalization Relationships ( generalization)
Between use cases: dependency, extend, generalization
|
Use |
Describe
the functional requirements through the scenarios
in which the user uses the system |
Legend: A diagram of the use
case
In order to make the reader see
more vividly, here is a legend to introduce the use
case diagram, and the following is the use case diagram
of the snake game.
Use Case Diagram Description:
Below is a diagram illustration
of the use case for the game of Snake
The usecase of the user "player"
is "set game" and "play game"
- There are two ways to play
Set Game: Set Rate and 《set size》
- "Play Game" includes
"Eat Food", and it is also possible 《save
game》
Each use case should be described
in detail, as shown below in the Play Game use case
The
name of the use case |
play
game |
Preconditions |
The game starts and the initialization is complete. |
Elementary
Stream |
1.Player
starts the game,
2.Game initializes the map,
3.Map appears on the food,
4.A snake climbs into the map,
5.Snake if it encounters food, eats it, adds 10
points,
6.If it encounters a wall, die, game over. |
Postcondition |
Displays
the number of points at the end of the game |
Alternate
flows |
In
basic streams 3-6, if the player wants Exit
the game,
the system asks if you want to save the game,
if the player chooses to save,
the game is saved, and you can continue the
next time you start the game |
Postcondition |
The
current progress of the game is saved, and you
can continue next time. |
Abnormal
flows |
In
Elementary Flow 2, the game records logs for post-mortem
analysis.
In basic streams 3-6, if the game exits abnormally,
a log is recorded for post-mortem analysis. |
Postcondition |
The
current progress of the game is saved, and you
can continue next time. |
Non-functional
requirements |
Performance
Requirements:
- The snake crawls one step per second,
- Updating the timing every second,
- Understand and update your points after
eating food.
Reliability requirements: The game should ensure
basic running ability, and there will be no freezes
or abnormal exits.
Expansion Requirements:
- Interface: Support to change the map background,
snake color.
- Data: You can set the width of the map,
the width of the snake.
- Operating Environment: Multiple operating
systems should be supported, including: windows,
Android, ios
|
Note: The model in this paper
is modeled by the modeling tool EA.
UML Diagram Series:
Postscript
I hope you have benefited from reading this.
If you are willing to share your experience, please submit it to us.
If you are interested in our training, consulting and tools:
|