UML & ModelingSequence DiagramsMedium⏱️ ~2 min

Sequence Diagram Structure and Components

Core Components of a Sequence Diagram
:User
:ParkingLot
:Ticket
requestEntry()
create()
ticket
ticket
1. Participants (Actors and Objects)

Participants appear at the top as rectangles. Format is name:Type or just :Type for anonymous instances. Examples: :User (actor), parkingLot:ParkingLot (named object), :PaymentProcessor (system component).

2. Lifelines

Vertical dashed lines extending downward from each participant representing the object's lifetime during the interaction. Time flows from top to bottom.

3. Messages (Method Calls)

Horizontal arrows between lifelines representing communication:

  • Synchronous Call: Solid line with filled arrowhead. Caller waits for response. Example: calculateFee(duration)
  • Return Message: Dashed line with open arrowhead. Shows value returned. Example: fee:Money
  • Asynchronous Call: Solid line with open arrowhead. Caller doesn't wait. Example: sendNotification()
  • Object Creation: Arrow pointing to object with «create» stereotype. Example: creating :Ticket
4. Activation Boxes

Thin rectangles on lifelines showing when an object is actively processing (executing a method). Nested boxes show recursive calls or delegation.

Interview Tip: Draw participants first, then add messages in chronological order. Don't overcomplicate with every getter/setter. Focus on meaningful business logic calls.
💡 Key Takeaways
Participants represent actors and objects involved in the scenario
Lifelines show temporal existence of objects
Synchronous messages (solid arrow) block until return
Return messages (dashed arrow) show data flowing back
Activation boxes show when object is processing
📌 Examples
1User to ParkingLot: requestEntry() creates Ticket
2Customer to ATM: withdraw(amount) synchronous, waits for response
3OrderService to NotificationService: sendEmail() asynchronous, doesn't wait
← Back to Sequence Diagrams Overview
Sequence Diagram Structure and Components | Sequence Diagrams - System Overflow