Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
721 views
in Technique[技术] by (71.8m points)

uml - How do I represent a loop in an activity diagram?

I'd like to represent a loop in a UML activity diagram. Here's my situation:

  • For each folder, I check each document within that folder
  • For each document I check its content:
    • If it's invalid (based on keyword searching), do action X and pass to next document.
  • When all document are verified, continue to the next folder.

Can anyone show me what this should look like?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are 3 different notations that you can use.

As your loop is based on some elements (folders, documents) the most convenient way is to use Expansion Region (of iterative type). Expansion Region example

Second option, that is a preferred choice when you have some guard based loop is a Loop Node. Loop Node example

The last possibility is to simply build correctly structured decision/merge structure. Decision/Merge example

The benefits of the first two are that they are compact and clear. It is also easy to have nested loops. Neither of this is true with the last option. Yet if you present your diagram to someone who is not familiar with UML (especially if you have no chance to explain a meaning of particular structure), the last approach usually is most widely recognized and understood.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...