3

in uml - system sequence diagram, can the system ask input from the actor (see attached picture)

example

In my example, the scenario is: system is prompting a confirmation input from user and user is to enter in the input.

Wondering if this is the correct representation for it? I asked as usually I have done it the other way round, in which actor gives input to the system and system return the output based on input...

Christophe
  • 68,716
  • 7
  • 72
  • 138
dissidia
  • 1,531
  • 3
  • 23
  • 53
  • for me the second way is the right way, the system show a dialog and the user ask the system to do confirm() / cancel() / ... – bruno Jul 25 '20 at 06:58

3 Answers3

3

Preliminary remark

The practice of showing an actor in an interaction diagram is well accepted and quite common.

Nevertheless, in principle, an UML interaction diagram such as a sequence diagram, should show interactions between lifelines within an enclosing classifier:

  • The actor being external to your system, it’s not a part of any enclosing classifier in your system.
  • As a consequence, this is valid UML only if the scope of your model is larger than the IT system, i.e. you model the organisatiin that uses your IT system.
  • Moreover the message semantic is not clearly defined for human participants, which is exactly the issue behind your question

Be consistent

If you choose to go on with your modeling approach and consider the actor as any other classifier, then your actor instance should behave as any other object.

The flow of messages shows which object is the sender of the message and which object responds. You should consistently keep this logic, as you did in your diagram. It will be btw one of the rare place on your model where you can show that the system is at the origin of this specific interaction and not the user. (hint: don’t forget the execution specification on the lifeline: it’ll increase the readability)

If you would materialize the free-will of the actor by an arrow/message in the opposite direction, you would only increase the ambiguity further: this would give the impression that the actor is at the initiative of the message, and that the actor could send a completely different message instead. And I’m not sure that your system is designed for responding to arbitrary messages from the user.

Another alternative?

A less ambiguous alternative could be to show the interaction between a system core element and an element that represents the UI: the UI element acts as proxy for the user, but since it’s an object like any other, the interpretation of message flows is unambiguous.

This is one of the idea behind the ECB decomposition, the C being a use-case specific controller (so it links this interaction to the requirements) and the B being the UI boundary exposed to a specific kind of actors (without entering into UI details).

Christophe
  • 68,716
  • 7
  • 72
  • 138
2

Short Answer: Yes

Of course, the context of this interaction cannot be the system, since the actor is outside of the system. However, it is allowed to not model the context and let the interaction be its own context. Or you could introduce a Context Class, that contains the Actor and the system. But these are only formal considerations.

More important is, whether it is useful to do this. I would say, it can be. Describing how an actor will interact with the system is one outcome of analysing the use cases. Many people will use text to describe this, but in complicated cases, UML behavior diagrams, like activity diagrams or sequence diagrams can be used.

I would reconsider using a synchroneous message here, though. Communication with a human actor is by nature asynchroneous. You never know, whether the message arrives, whether the actor understands it and whether the actor responds with the appropriate reply message.

PS: The reply message should show the name of the message it replys to, not some arbitrary text. If you want, you can show the return value after a colon (confirmationInput():Answer)

Axel Scheithauer
  • 2,758
  • 5
  • 13
1

Confirmation is vague.

As a response to user input this part would be missing in your SD. Being incomplete would not be wrong. In that case you just describe that part which starts from the confirmation.

As part of some system activity (e.g. you have a control process which detects over-heating and asks the user to continue with a shut down or so) that part would not show the start of the use case being likely something like "Observe XY".

In any case using system as life line to the right seems pretty much pointless. One would be interested in which object of the system is asking for confirmation.

The question is always: what does the editor of the diagram want to tell someone else.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86