Does the UML 2 Activity Diagram support looping? If so, is there an example? |
Request for Question Clarification by
maniac-ga
on
04 Jan 2006 18:10 PST
Hello Tomking,
Hmm. I have an answer / example, but I don't feel its worth $25. If
you like the answer, please adjust the price to the worth of the
answer to you and post a clarification request.
Yes - looping is supported in UML 2 activity diagrams. There is a good
explanation of these diagrams, including a looping example at:
http://www.agilemodeling.com/artifacts/activityDiagram.htm
Look in the upper left of the hand drawn figure 1 with the sequence
Start -> (loop start) Fill out Forms -> Inspect Forms -> Condition (loop end)
which loops until the condition of "correct forms" is satisfied.
There is a streamlined version in figure 2 that also loops / removes
the condition and clarifies which person (or the system) does what
activities.
--Maniac
|
Clarification of Question by
tomking-ga
on
05 Jan 2006 08:33 PST
Hi Maniac,
Yes, I saw Scott's example, but the question is whether UML 2 has a
standard for looping including the standard way to route the line that
loops back to an activity - where does the arrowhead go (e.g., to the
middle of an activity box, to the middle of the line leading into the
box, etc.) and how does the line route (e.g., through the middle of
the Activity Diagram, around the outside, etc.)? I have seen the
"expansive node" convention in which the activity is shown in a
special way to indicate iteration, but that is complex and not easily
understood by a business analyst. So what I'm looking for is a simple
line looping back to an earlier activity (action or conditional) and
whether that is supported by UML 2 and an example of such a diagram
showing the detail of how the line is shown, routed and attached.
Thanks, I really appreciate your help!
Tom King
|
Request for Question Clarification by
maniac-ga
on
05 Jan 2006 19:36 PST
Hello Tomking,
Well, the UML 2.0 standard at
http://www.omg.org/docs/formal/05-07-04.pdf
in section 12.3.5 briefly states in part
"An activity edge is notated by a stick-arrowhead line connecting
two activity nodes."
So according to that, the arrowhead goes to a box, not to another
line. That pretty much matches conventions from earlier diagram
methods that UML evolved from, or for that matter going back to hand
drawn flow charts. That's not to say that people don't draw diagrams
connecting to lines with an implied connector at at point.
There is no apparent standard for where you route the line. A common
method for state diagrams is to draw the loop back in parallel.
Something like:
A-->B
A<--B
(either straight or bended - there are several examples in the
standard) Adopting a similar method for simple loops in activity
diagrams would certainly be relatively easy to read and understand.
Examples of diagrams including loops are on page 312 (trouble ticket),
322 (proposal review), and 361 and 363 (building components). All of
these examples are admittedly quite simple but if you find you have
problems with "where to route the line", you may consider this a side
effect of a diagram that is "too complex" to understand.
[I personally prefer more diagrams with fewer boxes / lines because
they help focus your attention]
I find it a little odd that the standard has a "loop node" described
on pages 371 through 373 but there are no examples to review. [yes - I
read its a specialization of a structured activity node, but there are
no examples there either] It is certainly a nice pattern to follow if
it helps.
The other consideration you may want to review are the capabilities of
the drawing tool you are using. If using a specialized tool such as
those listed at:
http://www.uml.org/#Links-UML2Tools
would certainly help standardize your drawings (though the diagrams
you get may appear "ugly" because they implement the line routing in a
naive manner).
It may also be important how the diagrams are constructed if using a
back end code generator. The code generator may have constraints on
how the diagrams are constructed (though I expect this more a problem
with flow and state diagrams than an activity one).
--Maniac
|
Clarification of Question by
tomking-ga
on
06 Jan 2006 08:44 PST
Hi Maniac,
Thanks, that's very helpful information and certainly worth the $25!
Best regards,
Tom King
|