Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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.
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic