Book a Demo

Author Topic: How best to depict a loop on Activity diagram?  (Read 5434 times)

pab233

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
How best to depict a loop on Activity diagram?
« on: February 10, 2005, 04:05:16 am »
Hi All,

Does anybody have any suggestions about the best way to show a loop on an Activity Diagram?

I know that I can do it using similar ideas to the old flowcharts, but I'm not sure that this is the best way (and I have some nested loops that will make things REALLY ugly if done this way).

I've tried using the Fragment object from sequence diagrams but this doesn't really help in this situation.

Any ideas welcome.

cheers
pab

thomaskilian

  • Guest
Re: How best to depict a loop on Activity diagram?
« Reply #1 on: February 10, 2005, 04:19:07 am »
Try the Fragment elements from the toolbox. You can select Loop as type.

pab233

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: How best to depict a loop on Activity diagram?
« Reply #2 on: February 10, 2005, 04:33:43 am »
Hi Thomas,

I already tried that, but for some reason it deletes some of my condition when the diagram is saved and reopened.

For instance, if I put in "x=0; x < RecordsInList; x++", all that remains is "x=0".

I don't know whether this is a genuine bug, but since I was using a fragment on an Activity Diagram (rather than the "proper" place of a Sequence Diagram) I decided that it was something I shouldn't be doing.

cheers
pab

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: How best to depict a loop on Activity diagram?
« Reply #3 on: February 10, 2005, 05:14:12 am »
Quote
x=0; x < RecordsInList; x++",
Isn't a condition.

You should put x=0 as a node prior to the loop, x < RecordsInList in the condition, and ++x at the end of the loop.

(I use preinc for this idiom since I don't need the original value !)
« Last Edit: February 10, 2006, 01:11:44 am by mikewhit »

pab233

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: How best to depict a loop on Activity diagram?
« Reply #4 on: February 10, 2005, 05:59:41 am »
Thanks Mike,

Should have thought of that!  I think I was expecting a whizzier way of doing it.

cheers
pab