Why
do you need activity diagram modeling
The phrase "life is in motion"
illustrates that sport is a very important way for
people to observe the world, because the world of
motion is meaningful to us. People describe the process
as a sequence of actions arranged according to time,
because of the need to calibrate the relative order
of motion, man invented the concept of time (in my
opinion: time does not exist):
Absolute time: People choose
a relatively stable frame of reference in nature
to define time, such as one revolution of the earth
around the sun for one year, and one rotation of
the earth for one day. The Gregorian calendar uses
the year of Jesus' birth as the first year of the
Common Era.
Relative time: Arrange the
order of activities according to the order of movement,
such as the course of a person's life from morning
to night.
Man has also invented various
forms of describing movement:
1. Natural language uses narrative
to describe the process of a story.
2. Data flow uses the process
of data flow to describe the data relationships between
processes.
3. A flowchart describes the relationships
between individual processes in a controlled flow
manner.
4. … …
The activity diagram is a UML
modeling specification that uses graphics to describe
the behavior process, which integrates the description
forms of 2 and 3, and can fully support various descriptions
of the process in natural language. When the complex
behavior is based on the activity diagram to clarify
the order, the analyst will have a clear idea, and
the designer will also pay attention to the impact
of the behavior order on the logical correctness and
efficiency, which can greatly improve people's ability
to understand and control the behavior.
What's in the activity map
Any UML diagram has semantics,
elements, relationships, and uses, and the following
is a list of activity diagrams:
Semanteme |
Describe
the flow of the activities in the order in which
they are precededed |
Element |
Start
(init), activity Activity, Decision, Final,
Fork, Merge, Join |
Relationship |
Control
flow (control flow), object flow |
Use |
Business
processes, program flows, user operation processes
can be described |
Legend: Activity diagram
In order to make the reader see
more vividly, here is a legend to introduce the use
of the activity map, the following is the activity
map of the snake game.
Activity Diagram Description:
Here's a natural language text
description of the activity diagram of the snake game:
A
textual description of the process of the snake
game |
1.
The user executes "Activity: Start the Game"
2. "Activity: Start the Game" sends
"Object Flow: Start Instruction To"
to the game "Activity: Initialize Map Activity"
3. Game executes "Activity: Initialize Map"
4. Game executes "Activity: Create Food"
5. Game executes "Activity: Create Snake"
6. Start the timer and start the timing,
7. If the user executes "Activity: Press
the arrow key", then sets "Object: Direction"
8. "Event: 1 second to time", "Activity:
Perform Crawling", receive "Object:
Direction"
9. Snake executes "Conditional Judgment:
What to Encounter"
9.1. If it encounters food, the snake executes
"Activity: Eat Food".
9.2. If it encounters a wall, the snake executes
"Activity: Die"
10. The snake ends the current processing after
eating the food, and waits for the next "Event:
1 second up"
11. The game is over after the snake dies |
The above text description looks
tiring, if it is more complex to describe the behavior
process is more difficult to read, it seems that it
is better to use the activity diagram, or borrow the
form of the activity diagram and use a structured
text description, as follows:
Serial
numbe |
User |
Game |
1. |
Event:
Launch the Game |
|
2. |
"Activity:
Start Game"
Send "Object Flow: Start Instruction" |
|
3. |
|
"Activity:
Initialize Map" Receive
"Object Flow: Start Instruction" |
4. |
|
Activity:
Create Food |
5. |
|
Event:
Create a Snake |
6. |
|
Activity:
Start Timer |
7. |
Activity:
Press the arrow keys
Set Object: Direction
|
|
8. |
|
Event:
1 Second Up |
9. |
|
"Activity:
Snake Crawling" receives "Subject: Direction" |
10. |
|
"Conditional
Determination: What to Encounter"
If it encounters food, the snake performs the
"Activity: Eat the Food";
The snake ends the current treatment after eating
the food;
If it encounters a wall, the snake performs "Activity:
Dead";
The game ends when the snake dies. |
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:
|