2

I'm drawing some sequence diagrams to give a graphical depiction of the use cases written during the requirements elicitation phase for my project. This is a simple one:

Vote Post Use Case

  • Precondition: the user must be logged and the post the user wants to vote exists

  • Postcondition: the post is voted by the user

  • Steps:

    • 1: the user reaches the posts (includes "View Post" use case)
    • 2: the user clicks the dedicated button, according to the vote he intends to cast that can be either a negative or positive vote
    • 3: the system registers the vote cast by the user. If the post was already voted by the user, the system will override the old vote with the new one.
    • 4: the system throws a visual feedback to indicate that the operation has been performed successfully

In the sequence diagram with the analysis objects for this use cases, there is a message votePost(user, post, vote). Where does the user argument come from?

complex sequence diagram

Currently I did it so that the boundary object PostPage calls votePost(user,post,vote), assuming that it has knowledge of the user entity associated to the actor participating in the use case. Is it a correct approach, or should a third control object (called AuthenticationControl) be involved in order to get the current user?

If deemed useful, this is a portion of a class diagram showing the relevant entities :

class diagram with user, post and vote

1 Answer 1

3

Where does the parameter come from?

The parameter symbols such as user in the message arguments can for example be:

  • an object corresponding to another lifeline. But not here, since your lifelines are anonymous (no symbol before the :);
  • a property of the sending lifeline.
  • an object visible by the sending lifeline, such as property of the enclosing context or a globally known object
  • a parameter of a message previously received by the sending lifeline. But not here, since the only message was votePost(vote)
  • the result of a response message previously received by the sending lifeline. But not here, since no such message is received.

You could imagine that :PostPage knows it since it was specially created for the user interaction. But you could also think of some property that the enclosing context keeps once the user logs in. Up to you to make your choice.

What does the UML specs say?

Beyond these natural and straightforward possibiliies, there are many more possible origins, because the UML specifications leave the semantics unspecified:

UML 2.5.1, section 8.3.3.1 page 71: (...) However, the actual interpretation of the symbol depends on the context of use of the Expression and this specification does not provide any standard symbol definitions.

This gives you full freedom, including starting to gather requirements, and complete teh diagram afterwards to be sure that the needed paramters are known where they are needed.

Unrelated remarks

Are you sure that you are still modeling the requirements and that you did not accidentelly start to model the detailed design?

I'm asking because this diagram seems very detailed for a use-case scenario. Moreover, the succession of control creation (which represents in principle a use case according to the EBC model) looks more like a detailed description of the system's internals rather than a high level overview of the requirements (that could be discussed with a user) or the more detailed analysis of requirements.

1
  • 1
    Thank you for your broad answer, you've been really helpful. Regarding tithe "Unrelated remarks" part, I followed the heuristic that 1 case = 1 control, so that the total # of controls is 2 since the "ViewPost" UC is included. Also, the "vote overridden" behaviour is specified in the use case so I had to depict it in the diagram. If it wasn't specified then the "Vote Post" behaviour on an already voted post would've been undefined. I understand that it may look too "low-level" but I don't see any alternative
    – cidra
    Commented Feb 17, 2022 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.