Skip to main content

Sequence Diagram

It shows how objects interact in a time-sequenced manner. It captures the flow of messages between objects or components, representing their interactions in a time-ordered sequence. Sequence diagrams are often used to model the logic of methods, functions, and use cases, especially to show how various parts of a system collaborate.

Components:

  • Actors/Objects: Represent the entities (objects, users, or external systems) that interact in the scenario.
  • Lifelines: Vertical dashed lines that represent the life span of an object during the interaction.
  • Activation Bars: Thicker vertical rectangles(not dashed) along a lifeline showing the time an object is active and performing a task.
  • Messages: Horizontal arrows between lifelines that represent communication (method calls, responses, or signals). These can be:
    • Synchronous (solid line with a filled arrowhead): Represents a call where the sender waits for a response.
    • Asynchronous (solid line with an open arrowhead): Represents a call where the sender does not wait for a response.
    • Return Messages (dashed line): Represents the return of control or data from the receiver back to the sender.

Example:

Student          LibrarySystem           Librarian           Database
| | | |
|------------------>| | |
| Search Book | | |
| |-------------------->| |
| | Verify Availability |
| | |------------------->|
| | | Check Book Stock |
| | |<-------------------|
| |<--------------------| |
| Book Found | | |
| | | |
|------------------>| | |
| Borrow Book | | |
| |-------------------->| |
| | Validate User | |
| | | |
| | |------------------->|
| | | Update Records |
| | |<-------------------|
| |<--------------------| |
| Borrow Success | | |
|<------------------| | |
| Confirmation | | |

Other Symbol

Conditional:

----------------
| alt | |
|------ |
| |
| condition |
| |
|---------------
| |
| else |
| |
|---------------

Loop:

----------------
| loop | |
|------ |
| |
| statement |
| |
|---------------

Activation Bar

        |
|
|
|
|
|
|
|
|
|

Message:

    ---
| |
---