UML / Rose, Sequence Diagram Question
1 posts in topic
Flat View  Flat View

Posted By:   Kurt_Hansen
Posted On:   Monday, November 17, 2003 12:37 PM

Does anyone know how to describe conditionals (loops, if/then) in Sequence Diagrams in general and in Rational Rose specifically?

For example, getting data from either of two methods on a Home (i.e.-findAll() and findByDate(Date)), and then processing the returned data without regard to their specific source.

Should this even be in the Sequence Diagram?

How is it put there?

Re: UML / Rose, Sequence Diagram Question

Posted By:   Anonymous  
Posted On:   Thursday, November 27, 2003 01:10 AM

The problem you have is always a bit difficult with many tools, but with Rose it becomes a nightmare.

In principle, you represente an "if/then" by using a condition at the beginning of the message. A condition is presented in a guard like:
e.g. [age>18].
If you make you conditions exclusives on 2 branches you have the equivalente of an if/then/else.

For the loop it is the same notation but with a "*" at the beginning, like:
e.g. *[i=1..10].
Your message then looks like:
1:*[i=1..10] foo().

The notation is the same for collaboration and sequence diagrams.

You can use this notation with quite a lot of tools on the market, including free ones. Unfortunately Rose, made by the company of the creators of UML, is unable to do that. Rose, at least up to its 2002 version does not offer most of the UML notation. I am dealing with this problem daily and I still do not understand why it is like this.

Also, even with a good tool, UML (at least up to version 1.4) is still not very practical for writing loops, especially when you want more than one statement in it. If you are interested, I have written an article about that question available on our web site in the "Resources/Articles" section.

I hope it helps.


About | Sitemap | Contact