This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

condition clause for if-else in sequence diagram

 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Is there a UML condition clause for
if ( )
.....
else
.....
I know how to do "if" condition clause
but not "if - else".
Thanks.
JB
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can certainly do if-else branches in UML though their is not a standard way to achieve this. This is because of the flexibility inherit in UML. Just write your conditions so that they are easily recognized as being the inverse of each other.
 
Jim Baker
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So if-else would not conform to UML. Right?
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To an extent you can do this by using the following notation:
[x>10>]myMessageForFirstCase()
[x<=10]myMessageForAnotherCase()
if you need to do more elaborate cases such as multiple messages from an object based on the same conditional, then it is probably best to separate the alternatives into multiple sequence diagrams.
 
Jim Baker
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When U do this, it suggests that both conditions
are tested. It like if ... if ..., not if ... else ....
JB
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I disagree. A Sequence Diagram tells very little about the implementation. If you would like to test both conditions then that is fine, if not then it is just as good. The purpose of a Sequence or Collaboration Diagram is to show interaction between objects in a Use Case, no more, no less.
 
Jim Baker
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sequence Diagram does tell implementation details
if your diargam is for implementation. You can do reverse
engineering on classes or java files to get
sequence diagrams. But you may get if - else
that do not comform to UML. S.D. can be in three
levels: conceptual, specification, implementation.
 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic