if condition in uml class diagram?
Asked Answered
I

3

5

if "attribute" is true do this "operation" else do nothing.

How do i show this in uml class diagram.

Thank you, kim

Ibnrushd answered 7/4, 2010 at 4:40 Comment(0)
P
8

You don't. Class diagrams does not show behavior, but only structure. To show behavior you can use sequence diagrams, and a condition in sequence diagram is shown be be a rectangle which in its top corner you write the condition and inside it you describe the operation that occurs if condition is true. You can read here for more information: http://en.wikipedia.org/wiki/Sequence_diagram

Planer answered 7/4, 2010 at 4:52 Comment(0)
E
3

It seems that this user would like to add business rules with condition in the class diagram. this option is not graphically possible with UML but could be added manually in the metamodel.

It is better to use the sequence diagram and frames. I found an example alt text

Estey answered 7/4, 2010 at 10:32 Comment(0)
A
0

I think you can just disregard the else part.
So, just capture the if part using alt.

Check out Figure 8 in the example here: http://www.ibm.com/developerworks/rational/library/3101.html

Aureole answered 7/4, 2010 at 4:53 Comment(1)
Ooops, my bad. The poster was talking about class diagrams. Such restriction cannot be captured in class diagrams. What I presented to you was for sequence diagrams.Aureole

© 2022 - 2024 — McMap. All rights reserved.