If you are omitting the name, the colon in front of the type remains. Therefore, you should show the name of the parameter or attribute in the head of the lifeline, e.g. One final recommendation: Lifelines can represent attributes or parameters. I would rather use messages from the frame of the diagram, because in principle you know, where they come from, you just choose not to model it. You are using found messages for the messages coming from the user. Reply messages must return to the lifeline, that sent the synchroneous message, because "synchroneous" means that the sender is waiting for the reply. One mistake in the diagram is, that your reply messages are not consistent with the synchroneous messages. Sequence diagram has two features that distinguish them from communication diagramspresence of lifeline and focus of control. It shows a set of objects or roles and messages sent and received by them. When you send a buy-message to a Ticket object, what is it supposed to do with another Ticket object? A sequence diagram is an interaction diagram that emphasizes the time ordering of messages sent between objects. It is also strange, that Ticket.buy expects a parameter of type Ticket. However, this would only be visible in a sequence diagram, when the implementation leads to different messages being sent. I understand, that you want to express, that the implementation of getCost depends on the type of ticket. Therefore, the four Ticket lifelines should be only one and all the getCost-messages would be directed to the same lifeline that sends them. Then, why is a Ticket object communicating with a Single Use Ticket object? That would only make sense, if Ticket had an association to Single Use Ticket, which it hasn't. The next thing is, that a Ticket generalizes Single Use Ticket, so each object of type Single Use Ticket is also a Ticket. It doesn't have such an attribute, but we could interpret this as the result of some TypeOf()-function. Typically the guard will use some attribute of the type represented by the lifeline with the first message in the operand, Ticket in this case. If it is a guard, then it needs to be in square brackets. However, some things are unclear: In your operands you have a text (e.g."Single Use"). You are already using the correct element for this: A combined fragment with alt-operator.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |