nus-cs2103-AY1819S2 / forum

CS2103/T discussion forum
6 stars 1 forks source link

Questions on activity diagram #78

Closed lingyanhao closed 5 years ago

lingyanhao commented 5 years ago
  1. It was mentioned in lecture that activity diagrams should not contain cycles. Since this is the case, how do we represent loops?

  2. The parallel bar is used to indicate concurrent control flow. Is this notation used strictly for parallel/async commands or are we allowed to use that notation to represent independent calls in a fully sequential program?

kylase-learning commented 5 years ago

Any UML diagrams should make sense physically.

Let use a simple example for your second query.

void doEverything() {
  doA()
  doB()
  doC()
}

If we represent doA, doB and doC as concurrent activities, what happen when doA fails (and caused the program to fail? Will doB and doC be executed?

ccristina commented 5 years ago

Hi @lingyanhao,

I will do my favorite thing and reply to your questions with other questions:

  1. May I know why you say that activity diagrams should not contain cycles? When you say cycles, do you mean loops? The diagram in the lecture did not have loops, but there might be loops in the activity diagrams: check the examples in the textbook, under UML Activity Diagrams → Introduction → What (https://nus-cs2103-ay1819s2.github.io/cs2103-website/se-book-adapted/chapters/modeling.html).

  2. I would be tempted to say that the notation is not restrictive, and can be used in a fully sequential program. However, I need to ask how would you have parallel workflows in a fully sequential program?Most likely, you need to have parallel calls (some kind of parallelism using threads/processes) that would need parallel paths in an activity diagram.

Let me know if you have further questions.

Best regards, Cristina.