Franky1790
Franky1790

Reputation: 81

Method in sequence Diagram

I have an Interview question, then I try to find It's question in Internet, but I cant find it. enter image description here

I answered it, but I still confused with my answer. Because I think Post() is part of Invoice class too.

Upvotes: 1

Views: 895

Answers (1)

qwerty_so
qwerty_so

Reputation: 36333

No. The message shows what is called not who/what is calling. So Publish() is an operation of Invoice and Post() is one of GeneralLedger (called from Invoice). Validate() is also an operation of Invoice. It's just a self-call here.


N.B. I'm using a colloquial description above. To start with, I repeat @Christope's comment that the question itself is flawed.

  • method is the wrong term. It is commonly used (mostly in the MS world) but what it should read here is operation (UML 2.5 p. 15: operation owned by a class may have a related method that defines its detailed behavior)
  • Top of the life lines it only denotes objects, not the classes they were derived from. One could think of the class names being the same, but to be correct it needs to be :<class> or <objName>:<class>. Without colon it's only the object name.
  • The return arrow has a wrong arrow. It needs to be an open one, not a filled one. Semantics of arrow renderings are crucial in UML.
  • The messages (the solid lines ones above) are define in UML 2.5 (p.574) as A message is shown as a line from the sender MessageEnd to the receiver MessageEnd. The line must be such that every line fragment is either horizontal or downwards when traversed from send event to receive event. The send and receive events may both be on the same lifeline. The form of the line or arrowhead reflects properties of the message...
  • So the text above the messages is the message signature which corresponds to an operation in the object pointed at (for more see the UML specs).

Upvotes: 3

Related Questions