12

Is there any "switch case" in use-case specification?

In the requirements:

  • When user select "contract" in combobox, a "contract" tab appears, then user will interact with the "contract" tab.
  • When user select "Independently funded", a "Funding" tab appears, then user will interact with the "funding" tab.

How can I specify this use-case in my use-case specification?

Those two "case" will be in basic flow, won't they? Then how can I specify the "switch-case"?

Edit: (Because many mistakes what I'm doing, I will make it clear)

I'm not in progress of drawing use-case or drawing activity diagram, I'm in the between. I'm writing use-case specification (which is used to describe a use-case, and will be used later to draw activity diagram).

For more detail: https://www.google.com.vn/search?q=use-case+specification&biw=1280&bih=683&source=lnms&tbm=isch&sa=X&ved=0CAYQ_AUoAWoVChMIn6ujsMDRxwIVC5COCh3aNQGY#

Susuri Yuyuki
  • 153
  • 1
  • 3
  • 8
  • Do you want to draw a use-case or a activity diagram? – sergej Aug 30 '15 at 18:13
  • I'm writing use-case specification, which will then be used to draw activity diagram. The normal process is : draw use-case diagram -> write use-case specification for each use-case -> draw activity for each use-case – Susuri Yuyuki Aug 30 '15 at 19:14
  • _Related:_ [How do I draw a switch statement in a graphical design?](https://stackoverflow.com/a/22067183/814702) – informatik01 Sep 05 '19 at 08:27
  • Also here is a related tutorial, where on the Step 6 you can see an example of the "switch" statement drawn using UML: [Simple Guide on Creating Flowchart for Switch Statement](https://www.edrawsoft.com/flowchart/flowchart-for-switch-statement.php). – informatik01 Sep 05 '19 at 08:30

3 Answers3

19

If you are describing the use case in the notes then write something like

Step m: User selects ?? from combobox. If selection is "contract" resume at Step n. If selection is "Funding" resume at Step o. ... ...

Step n: Resume at Step p.

Step o: Resume at Step p.

Step p: ...

where m, n, o and p are subsequent step numbers in your scenario.

If you are using Activities with Actions you can use a Decision node from where you have multiple outgoing transitions. Each transition then has a guard describing the switch (kind of a multi-if).

enter image description here

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
6

PlantUML suggests elseif-chains which gives also a nice graph.

example

Fookiee
  • 156
  • 1
  • 12
  • 1
    The guards must be enclosed in square brackets. – qwerty_so Oct 25 '19 at 20:20
  • Also, the decision node as per UML specs is not hex but quad edged (parallelogram standing on its edge). – qwerty_so Oct 25 '19 at 20:24
  • That was not my suggestion. It's from plantuml page. The red lines/yellow background is such oldschool, that I always thought it may be UML 1.x. I agree, that this violates the UML specs + my aesthetics. But it is sufficient to show the idea – Fookiee Nov 04 '19 at 17:47
  • More or less. I agree that the idea in conveyed. But showing a picture should comply to the standard. Even UML 1.5 states: _The icon provided for a decision is the traditional diamond shape, with one incoming arrow and with two or more outgoing arrows, each labeled by a distinct guard condition with no event trigger._ So you'd better used Powerpoint in that case. You should report a bug at PlantUML. – qwerty_so Nov 04 '19 at 22:46
  • 2
    "You should report a bug at PlantUML" - this is a good idea! I'm going to look for their bug tracker. – Fookiee Nov 06 '19 at 12:53
  • If you add a remark to your answer about the shown bugs (decision and guards) I'll revoke my down vote. – qwerty_so Nov 06 '19 at 13:27
  • ;) Setting up a bounty is effective nudging. *thumbs up* – Fookiee Nov 06 '19 at 14:25
  • Quick tip for anyone who wants to have the diamond-style decision step. Use: skinparam conditionStyle InsideDiamond – aalosious Mar 22 '21 at 14:29
3

I think this one fulfill the purpose of the cases and follows the UML decision object rules.

enter image description here

Jonathan Ramos
  • 1,921
  • 18
  • 21