Quick Observations:
(1) Remember that a class / object can send messages to itself (“DoSomething”), this makes “alternatives” more difficult to prevent.
(2) When using "alt", you must specify the conditions. "alt" represents "if-then-else", "switch-case" and similar concepts from programming languages.
And these sentences have conditions that must be added to the UML diagrams ("[condition]").
(3) Within each condition or case of "alt" there can be several messages among several objects, either for oneself or not (only the arrow "return").
.......................................................... .......+---------+..............+---------+............... .......| Foo |..............| Bar |............... .......+----+----+..............+----+----+............... ............|........................|.................... ..........+-+-+....................+-+-+.................. ..........| |......methodX().....| |.................. ..........| +------------------->+ |.................. ..........| |....................| |..DoSomething()... ..........| |....................| +---+.............. ..........| |....................| |...|.............. ..........| |....................| |...|.............. ..........| |....................| |...|.............. ..........| |....................| |<--+.............. ..........| |....................| |.................. ..+-----+-------------------------------------+........... ..|.alt.|.| |....................| |......|........... ..+-----+-------------------------------------+........... ..|.[option=1].....................| |......|........... ..|.......| |....................| |......|........... ..|.......| |....................| +---+..|........... ..|.......| |....................| |...|..|........... ..|.......| |....................| |...|..|........... ..|.......| |....................| |...|..|........... ..|.......| |....................| |<--+..|........... ..|.......| |<-------------------+ |......|........... ..|.......| |....................| |......|........... ..+-----+-------------------------------------+........... ..|.[option=2].....................| |......|........... ..|.......| |....................| |......|........... ..|.......| |....................| |......|..// The wide bar its kept, ..|.......| |<-------------------+ |......|..// even if there is a ..|.......| |....................| |......|..// previous return arrow ..+-------------------------------------------+........... ..|.[else]|...|....................| |......|........... ..|.......| |....................| |......|........... ..|.......| |....................| |......|........... ..|.......| |<-------------------+ |......|........... ..|.......| |....................| |......|........... ..+-------------------------------------------+........... ..........| |....................| |.................. ..........+-+-+....................+-+-+.................. ............|........................|.................... ............|........................|.................... ............X........................X.................... ..........................................................
Greetings.
PD Any Cheeseburger or Catfish Tuna Fisherman?
source share