1

I have a class called booking that requires a payment to be completed and also requires a confirmation to be sent. I have three classes: booking, confirmation and payment but I'm not sure how to demonstrate that the booking class requires both a payment to be completed and a confirmation to be sent. I considered using composition but I'm not entirely sure.

0

1 Answer 1

2

A class diagram will only show structure, but you are talking about behavior. You will show that in either a sequence or an activity diagram.

enter image description here

Here I made the Confirmation an association class which connects Booking and Payment.

enter image description here

And this is a simplistic representation of what happens when doing a booking.

N.B. with regards to @granier's comments:

  • P. 373 of the specs

    When a node completes execution, a token is removed from the node and tokens are offered to some or all of its outgoing ActivityEdges.

  • P. 401

    An ExecutableNode may also consume and produce data, but it must do so through related ObjectNodes.

    ...

    That is, there is an implicit fork of the flow of control from the ExecutableNode to its outgoing ControlFlows.

Sign up to request clarification or add additional context in comments.

10 Comments

Okay so would it would just be a composition relationship where the booking cannot exist without the payment for instance?
Just forget about composition. Just make an association with the right multiplicity. That's enough for the structural part.
I added sample diagrams.
@Kilian i am not sure that you can have an object like you model, i invite you to check the norm. If i read the UML certification book, This Object creation creates a token and then that's an issue.
@granier I was uncertain about that too. But Send confirmation has an implicit fork (you remember?). And elements with no outgoing flow swallow the token when done (written somewhere else). So that's absolutely correct. Actually the flow to final from Send... could be omitted too.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.