4

When we write a use case table * (id, description, actor, precondition, postcondition, basic flow, alternate flow)*, in basic flow, we show plain steps of interactions between the actors and the system. I wonder how to show a condition in the use case basic flow? AFAIK, the basic flow contains plain simple steps one by one for use case. But I cannot show conditions without pseudocode? Are pseudocodes allowed in the basic flow of UML use case description?

What would be steps for below sequence? enter image description here

For the above diagram, should be the table below?

-------------------------------------------------------------
| ID            | UC01                                      |
-------------------------------------------------------------
| Description   | do something                              |
-------------------------------------------------------------
| Precondition  |  --                                       |
-------------------------------------------------------------
| Postcondition |  --                                       |
-------------------------------------------------------------
| Basic flow    |  1. actor requests system to do something |
|               |  2. if X = true                           |
|               |        2.1 system does step 1             |
|               |     else                                  |
|               |        2.3 system does step 2             |
|               |  3. system return results to actor        |
-------------------------------------------------------------
| Alternate flow|  --                                       |
-------------------------------------------------------------
Zoe
  • 27,060
  • 21
  • 118
  • 148
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
  • 1
    Sorry, it's a bit unclear what you're asking. Can you use the alt condition when creating a sequence diagram for Use Case? Yes. You depict not only the basic flow but also alternate flows. No need for pseudocode. – Ister Jul 22 '18 at 16:19
  • @Ister there can be repeat, if, else etc. different semantic context, how can I deal all those stuffs in alternate flow? could you explain what would be sample usecase table for the posted diagram? – Sazzad Hissain Khan Jul 22 '18 at 16:51
  • There are various types of expansion regions in sequence diagrams. The various kinds allow you to cover different flow alterations. Read through those first and then try asking more specific question. – Ister Jul 22 '18 at 22:13
  • Whatever serves the communication is allowed as long as it's understandable by the audience (which then is a bit of a Catch 22). – qwerty_so Jul 22 '18 at 22:17

2 Answers2

3

In tools like Visual Paradigm you can model flow of events with the if/else and loop conditions, and specify the steps as user input and system response. enter image description here

Rain Wong
  • 638
  • 2
  • 5
  • 9
2
  • Use Alternate and Exceptional flows to document such behavior.
  • do something and step 1 are clearly of different levels, better put them into separate use cases.
  • Actor is not the best name for actor's role, let's say it's a User.
  • I had to change Step 1 to Calculation 1 to avoid confusion.

Example

------------------------------------------------------------------------
| ID               | UC01                                              |
------------------------------------------------------------------------
| Level            | User goal, black box                              |
------------------------------------------------------------------------
| Basic flow       |  1. User requests Robot System to do something.   |
|                  |  2. Robot System performs UC02.                   |
|                  |  3. Robot System return results to User.          |
------------------------------------------------------------------------


------------------------------------------------------------------------
| ID               | UC02                                              |
------------------------------------------------------------------------
| Level            | SubFunction, white box                            |
------------------------------------------------------------------------
| Basic flow       |  1. Robot System validates that X is true.        |
|                  |  2. Robot System does Calculation 1.              |
------------------------------------------------------------------------
| Alternate flow 1 |  Trigger: Validation fails at step 1, X is false. |
|                  |  2a. Robot System does Calculation 2.             |
------------------------------------------------------------------------
Vlad
  • 497
  • 1
  • 3
  • 8