2

i've my project and this is my Sequence Diagram. Is it legal? enter image description here

Can i start my sequence diagram like that?

bruno
  • 32,421
  • 7
  • 25
  • 37
MrBuffalo
  • 137
  • 1
  • 1
  • 9

1 Answers1

3

The first message on the left is a found message (see §17.4.4.1 page 577 of formal/2017-12-05) and its use is perfectly legal.

bruno
  • 32,421
  • 7
  • 25
  • 37
  • Thanks Bruno, should i use a lost message then? or it isnt necessary? – MrBuffalo Feb 16 '21 at 20:37
  • @MrBuffalo the presence of a found message does not imply the presence of a lost message, they are not correlated – bruno Feb 16 '21 at 20:38
  • 2
    And moreover, normally there should be no actor in a sequence diagram, because the actor does not belong to an enclosing classifier of the system. – Christophe Feb 16 '21 at 20:49
  • @Christophe My idea was to represent a sequence diagram of a screen that can be called by any actor on the system. Is this a correct way? – MrBuffalo Feb 17 '21 at 07:41
  • @MrBuffalo A Lifeline represents a ConnectableElement (§17.12.17.4), but an Actor is not a ConnectableElement, so you cannot in theory if your actor is a 'real' actor – bruno Feb 17 '21 at 07:43
  • @bruno I have several actors who can start the same sequence, what can I do? – MrBuffalo Feb 17 '21 at 07:45
  • @MrBuffalo are you sure they are actor as specified in § 18.2.1 ? – bruno Feb 17 '21 at 07:48
  • @bruno sorry but your link doesnt work, i cant check it. I thought about this solution given his definition: A found message is a message where the receiving event occurrence is known, but there is no (known) sending event occurrence. – MrBuffalo Feb 17 '21 at 07:51
  • @MrBuffalo sorry, I corrected link ( https://www.omg.org/spec/UML ) – bruno Feb 17 '21 at 07:59
  • @bruno yes, they are. I'm trying to generalize a common behavior of multiple actresses. is it better to create a sequence diagram for each actor? – MrBuffalo Feb 17 '21 at 08:03
  • 2
    @MrBuffalo again a lifeline cannot represent an actor (from use case), in your case actors are very probably instances of class. Note they can be shown as actor even they are not. After there is no rule in UML saying what an interaction (possibly shown through a sequence diagram) must represents, you are free, the only rule is to have readable diagrams and they must have a 'real' goal e.g. to say something interesting – bruno Feb 17 '21 at 08:13
  • @bruno thanks, i'm a bit confused about. My teacher don't explain me that and he uses actor (from use case) to start the sequence diagram. – MrBuffalo Feb 17 '21 at 08:19
  • @MrBuffalo is quite common, but even you see an actor this must not be really an actor but just the use of an actor icon, else the standard is not followed – bruno Feb 17 '21 at 08:23
  • 2
    @MrBuffalo That’s embarrassing, when teachers don’t show it the right way ;-) To his/her defence, despite being not fully legal, it’s a widely used practice. See this other question for more details: https://stackoverflow.com/a/63098812/3723423 – Christophe Feb 17 '21 at 08:41
  • @Christophe now i can know that.. Without this question I had an incorrect view of the sequence diagrams. Thanks to all. – MrBuffalo Feb 17 '21 at 08:52
  • Actors can be represented by lifelines. Lifelines represent properties and parameters (aka connectable elements). So in order to represent an actor or a class there needs to be a property or parameter typed by them. Actors are the type of the property of the association that connects them to use cases. Or there could be an interaction owned property typed by an actor. Some tools make this completely transparent to the modeler by simply creating this property in the background when an actor is dropped on a sequence diagram. – Axel Scheithauer Feb 17 '21 at 13:03