How can I simulate an object that was returned from a function call in a sequence diagram?

Suppose I have code like

user = AuthHandler.getLoggedInUser() user.setName(name) UserDAO.update(user) 

What will the sequence diagram look like?

I did

Is it correct? user / userDAO part?

+8
uml sequence-diagram
source share
2 answers

Sequence diagrams do not require detailed information about the returned object.

When an operation is performed on an object / class (rectangles), the returned dashed arrow should return to the line and the object from where it came from.

uml sequence diagram returning value

If a value is returned (an object or a simple type variable is called), its identifier should appear above the returned arrow.

Optional return tags may appear above arrows that do not explicitly return a value.

There are several tutorials on the Internet, I recommend:

http://www.agilemodeling.com/essays/umlDiagrams.htm

EDIT:

In sequence diagrams, the returned type of an object is indicated by an identifier in the text in each field, for example, "user: user" or ": UserDAO".

Then, an additional object diagram or an object diagram based on these objects can provide additional information to the actual sequence diagram using the same class identifier or object identifier, For example: β€œUser” or β€œUser”.

Do not confuse class id with instance id.

Please note that in this figure, some fields skip the instance identifier of a particular object or replace it with an asterisk.

+10
source share

The chart is correct, as far as I can see. There is no graphic symbol to display the flow of objects in sequence diagrams - only the parameters in the message, as you showed. (c / f activity diagrams that have a designation for the flow of an object).

NTN.

0
source share

All Articles