- Its focus is on identifying interactions between objects over time.
- Its major benefit is helping the identification of the message exchanged between objects.
- Exchanging messages requires a sender and receiver.
- A receiver must have an interface in order to receive a message.
- An interface is an operation signature on the class to which the receiving object belongs.
- The Sequence diagram helps us find and document new operations on-the Class diagram.
- The following figure models three objects: a customer actor, a theater system, and a venue, and three messages.
- The theater system asks the venue for a set of events taking place in a specified date range.
- The venue returns the set of events.
- The theater system then sends the events to the customer actor (user interface) to be displayed.
- The types of arrows describe the type of interaction.
- The messages become operation signatures.
- The returns help validate the interaction.
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a6b27ab4-e864-4f10-bc3a-506a24750436/Untitled
Notations
- A sequence diagram shows an interaction, which represents the sequence of messages between instances of classes, components, subsystems, or actors.
- Time flows down the diagram, and it shows the flow of control from one participant to another.
- The diagram shows example instances and events, instead of classes and methods; more than one instance of the same type can appear in the diagram, and more than one occurrence of the same message can appear also.
- Lifeline: A vertical line that represents the sequence of events that occur in a participant during an interaction, while time progresses down the line.
- This participant can be an instance of a class, component, or actor.
- Actor: A participant that is external to the system that you are developing.
- You can make an actor symbol appear at the top of a lifeline by setting its Actor property.
- Synchronous message: The sender waits for a response to a synchronous message before it continues.
- The diagram shows both the call and the return.
- Synchronous messages are used to represent ordinary function calls within a program, as well as other kinds of messages that behave in the same way.
- Asynchronous message: A message that does not require a response before the sender continues.
- An asynchronous message shows only a call from the sender.
- Use to represent communication between separate threads or the creation of a new thread.
- Execution occurrence: A vertical shaded rectangle that appears on a participant's lifeline and represents the period when the participant is executing an operation.
- The execution begins where the participant receives a message.
- If the initiating message was a synchronous message, the execution ends with a «return» arrow back to the sender.
- Callback message: A message that returns back to a participant that is waiting for the return from an earlier call.
- The resulting execution occurrence appears on top of the existing one.
- Self message: A message from a participant to itself.
- The resulting execution occurrence appears on top of the sending execution.