Pregunta

This is only an extract from a very long text, the one I'm not sure about. It's about a photo booth (an automata that makes a picture of you if you insert coin).

The automata has a camera that is recording once a coin is inserted. The customer has 2 minutes to freeze the video right after the coin was inserted, such that he/she has taken a picture. Then the customer can decide if he/she likes to print this picture or change back to the recording mode such that the camera is recording again so he/she can take a picture again. Within these 2 minutes, the customer can switch from recording mode to a picture untill he/she decides to print it.

If the customer has accepted a picture, it will be printed. If after the 2 minutes no picture was taken by the customer to be printed, then the latest taken picture will be chosen and printed. If there was not a picture taken at all, then the automata returns the coin that was inserted by the customer.


I'm not sure about the beginning. So clearly we have 2 simultaneous things at the beginning when coin is inserted: The camera is recording AND the 2 minutes timer starts running. But how do you show that in an activity diagram? Can I just show both these things as an activity, like that and go on?

Edit: Here the diagram that is supposed to represent Christophe's solution enter image description here

And this is my old wrong diagram:

enter image description here

¿Fue útil?

Solución

Problem

Your diagram has several flaws. For instance, you'd need a join to synchronize the camera recording and the timer. But then, the semantic would mean that both activities must be finished before going on, so that in the end you would wait at least 2 minutes.

Solution

To solve this correctly, you must enclose the sequence of action that can be interrupted in an interruptible region (dotted surrounding).

You would then have in this region an accept event action (or better, a wait time action), that on timer elapse would interrupt the region, leaving it through an interrupting edge to the action that will be performed upon time-out.

By the way, you could also consider a send signal action to represnet the "take picture" action, that would leave the interruptible region as well. Once an event/signal caused to leave the interruptible region, all the tokens circulating in the region are considered instantly consumed.

In this modelling you'd not need an artificial fork and join for a non existant parallel activity.

You will find a complete example with time-out here.

Licenciado bajo: CC-BY-SA con atribución
scroll top