Usage of Owned Object Sequence Diagram

If a user on a website were to interact with it and presses a button that calls a method of an owned object. For example an Order owns a Muesli and the user adds something to that muesli pressing a button. Do we then need to draw a line between the User and the Object owning the muesli or can a line be drawn directly to the muesli, which is behind an Ownership by another Object? Example below

Hi,

In sequence diagrams, you can only call/interact with objects the current object owns/has access to. In your scenario you should call the order first i.e. lets assume the order has a function: addIngredient(ingredient: Ingredient): Unit. Now we call this function. Now we are active in the Order within the function addIngredient. From here, the order has access to the muesli. So we can call a function of the muesli i.e. (setIngredient(ingredient: Ingredient)).

In summary, you have to call twice to reach your muesli.

3 Likes