Java Reference
In-Depth Information
Rules for forming structured programs
1. Begin with the simplest activity diagram (Fig. 5.23).
2. Any action state can be replaced by two action states in sequence.
3. Any action state can be replaced by any control statement (sequence of
action states, if , if else , switch , while , do while or for ).
4. Rules 2 and 3 can be applied as often as you like and in any order.
Fig. 5.22 | Rules for forming structured programs.
action state
Fig. 5.23 | Simplest activity diagram.
Applying the rules in Fig. 5.22 always results in a properly structured activity diagram
with a neat, building-block appearance. For example, repeatedly applying rule 2 to the sim-
plest activity diagram results in an activity diagram containing many action states in sequence
(Fig. 5.24). Rule 2 generates a stack of control statements, so let's call rule 2 the stacking rule .
The vertical dashed lines in Fig. 5.24 are not part of the UML—we use them to separate the
four activity diagrams that demonstrate rule 2 of Fig. 5.22 being applied.
apply
rule 2
apply
rule 2
apply
rule 2
action state
action state
action state
action state
action state
action state
action state
action state
o
Fig. 5.24 | Repeatedly applying rule 2 of Fig. 5.22 to the simplest activity diagram.
 
 
Search WWH ::




Custom Search