Welcome back. In the previous lesson, you created a UML class diagram for a parking-lot design: it showed the stable structure of the system—objects such as ParkingTicket, ParkingLot, and PricingPolicy, along with their relationships and responsibilities.
A sequence diagram supplies the complementary runtime view. Rather than asking “what objects exist?”, it asks: during one concrete use case, who calls whom, in what order, and which object changes state? This is especially useful in an LLD interview because it validates that the responsibilities in your class diagram can actually collaborate to complete the workflow.
In this lesson, you will trace a parking-lot exit flow as an interview-ready UML sequence diagram. You will learn to choose participants, order messages, represent replies and execution, and decide when alternatives or asynchronous interactions belong in the diagram.
From static structure to runtime collaboration
A class diagram is a map of the system’s stable design. A sequence diagram is a time-ordered trace through that design.
For the parking lot, suppose the scoped use case is:
A driver exits with an active ticket. The system calculates the parking fee, closes the ticket, releases the occupied spot, and returns an exit receipt.
A useful sequence diagram should answer these questions clearly:
- Which external actor begins the interaction?
- Which object receives and coordinates the request?
- Which domain object owns each state change?
- Which collaborator provides variable behavior, such as pricing?
- What values must return before the flow can continue?
- What happens if an important precondition is not true?
The vertical dimension represents time: messages higher in the diagram happen before messages lower down. The horizontal dimension lists the participating actors and objects.
How to Make a UML Sequence Diagram
Watch “How to Make a UML Sequence Diagram” by Lucid Software for a concise visual introduction to the notation and the process of assembling a scenario.
Start with the purpose to reinforce the distinction between chronological interactions and a static design. Then watch participants and messages, focusing on how the video distinguishes an external actor from system objects and places them left to right. Continue with replies and alternatives for dashed return messages and alt frames. Finish with activation boxes, noting that they show periods of execution, not exact production latency.
The small set of notation that matters in an interview
For most LLD interview diagrams, a handful of UML elements is enough.
| Element | Meaning | Parking-lot example |
|---|---|---|
| Actor | An external role that initiates or participates in the use case | Driver |
| Lifeline | A participant’s presence during the interaction, drawn as a vertical dashed line | parkingService: ParkingService |
| Activation | A period when that participant is executing behavior | ParkingService handling exit(...) |
| Call message | One participant invokes an operation on another | quote(duration, vehicleType) |
| Reply message | A result or return of control, usually dashed | fee: Money |
| Self message | An object invokes an internal operation on itself | ParkingTicket validates its own closing rules |
| Create message | A participant creates an object during this scenario | A ticket created during vehicle entry |
| Destroy marker | An object’s lifetime ends during the scenario | Usually unnecessary for a parking exit flow |
For an object lifeline, use the form:
roleName: ClassName
For example:
parkingService: ParkingService
ticket: ParkingTicket
pricingPolicy: PricingPolicy
The role name is helpful when a class may have several instances. A system could contain many ParkingTicket objects, but this diagram follows the particular ticket involved in this one exit.
Synchronous versus asynchronous messages
A synchronous call means the caller needs the result before continuing. In this use case, pricing is synchronous: ParkingService cannot close the ticket until it knows the fee.
An asynchronous message means the sender can continue without waiting for the receiver. For example, after the exit is successfully committed, the system might publish a ParkingExited event for a receipt-email component. The driver does not need to wait for that email to leave the gate.
Do not label something asynchronous merely because it crosses a network. The meaningful question is whether the caller’s behavior depends on a response.
A practical interview rule:
- Use synchronous calls for the domain decisions required to complete the principal use case.
- Add asynchronous messages only where the requirement explicitly permits eventual completion, such as analytics, notifications, or audit publishing.
- Do not clutter the first version of a sequence diagram with speculative integrations.
Reading the parts of a sequence diagram
The following guide is a useful reference for the formal terms while you practice drawing. Its main value is the disciplined workflow: pick the normal scenario first, identify only the participants needed for it, then add alternatives deliberately.
Creating Sequence Diagrams in UML: A Comprehensive Tutorial - Visual Paradigm Guides
Read Visual Paradigm Guides’ “Creating Sequence Diagrams in UML” to consolidate the notation and use a repeatable drawing process.
In “Introduction to Sequence Diagrams,” read the overview. Focus on why a sequence diagram can model one concrete scenario rather than every behavior of the system. Next, in “Drawing a Sequence Diagram: Step-by-Step Guide,” read the six-step process. Use it as an interview routine: begin with the happy path, then add only material exceptions. Finally, in the professional advice section, read the guidance beginning with participant naming. Pay particular attention to simplicity, descriptive message names, and using combined fragments only when they clarify a real branch, option, or repetition.
A few judgment calls matter more than perfect notation:
-
Show collaboration, not every line of code.
ParkingTicket.close(exitAt, fee)is meaningful. Internal formatting of a receipt is usually not. -
Make messages match class contracts.
If the sequence diagram hasPricingPolicy.quote(...), the class diagram should show a compatible operation. When the diagrams disagree, the design is incomplete. -
Use replies for important returned data.
A reply labeledfee: Moneyshows why the next call is possible. You do not need to draw every trivial PythonNonereturn. -
Stay at one abstraction level.
If this is an object-level LLD diagram, do not suddenly insert HTTP headers, ORM query plans, and deployment infrastructure. If you include a controller or repository, do so because its responsibility matters to the use case.
Trace the parking-lot exit use case
Start from the contracts implied by the previous lesson’s class diagram:
ParkingService.exit(ticketId, exitAt): ExitReceipt
ParkingLot.findOpenTicket(ticketId): ParkingTicket
ParkingTicket.durationUntil(exitAt): Duration
PricingPolicy.quote(duration, vehicleType): Money
ParkingTicket.close(exitAt, fee): void
ParkingLot.release(spot): void
These are not required to be the final Python method signatures. They are a design-level contract for the use case.
1. Choose the lifelines
For the intentionally small scope, use these participants:
Driver— the external actor.parkingService: ParkingService— the application-facing coordinator.parkingLot: ParkingLot— locates the active ticket and releases the spot.ticket: ParkingTicket— owns the state of one parking visit.pricingPolicy: PricingPolicy— calculates a fee through a replaceable pricing rule.
Notice what is absent:
- No database lifeline, because persistence is not the design question in this scenario.
- No concrete
HourlyPricinglifeline, becauseParkingServiceshould depend on thePricingPolicyabstraction. - No receipt-email service, because delivering email is not needed to let the driver exit.
A production backend may certainly have controllers, repositories, payment providers, and messaging systems. The diagram’s scope should follow the requirement, rather than trying to display the whole architecture.
2. Draw the success path from top to bottom
The following table is the exact runtime story your diagram should communicate. Place each row below the preceding one.
| Order | Sender | Receiver | Message and intent |
|---|---|---|---|
| 1 | Driver | ParkingService | exit(ticketId, exitAt) initiates the use case. |
| 2 | ParkingService | ParkingLot | findOpenTicket(ticketId) locates the ticket that may be closed. |
| 3 | ParkingLot | ParkingService | Reply with ticket. The service now has the visit record. |
| 4 | ParkingService | ParkingTicket | durationUntil(exitAt) obtains the chargeable duration. |
| 5 | ParkingTicket | ParkingService | Reply with duration. |
| 6 | ParkingService | PricingPolicy | quote(duration, vehicleType) delegates the variable fee rule. |
| 7 | PricingPolicy | ParkingService | Reply with fee: Money. |
| 8 | ParkingService | ParkingTicket | close(exitAt, fee) changes the ticket from open to closed. |
| 9 | ParkingService | ParkingLot | release(ticket.spot) makes the allocated spot available. |
| 10 | ParkingService | Driver | Reply with ExitReceipt(ticketId, fee, exitAt). |
This trace reveals a useful responsibility split:
ParkingServicecoordinates the use case.ParkingTicketowns lifecycle state for the parking visit.PricingPolicyowns the fee calculation rule.ParkingLotowns spot availability.
The service does not compute a parking fee directly, and the pricing policy does not mutate ticket state. That is exactly the separation the class diagram was intended to make visible.
3. Add activation bars carefully
Activation bars make the collaboration easier to scan:
ParkingServicehas a long activation, beginning when it receivesexit(...)and ending when it returns theExitReceipt.ParkingLothas short activations while locating the ticket and releasing the spot.ParkingTickethas short activations while calculating duration and closing itself.PricingPolicyhas a short activation while computing the quote.
Do not interpret the length of an activation bar as an actual latency estimate. It represents control and execution in the modeled interaction, not a performance measurement.
Conditions, loops, and optional behavior
A sequence diagram should represent important control flow without becoming a screen full of boxes. UML uses combined fragments for this purpose.

The Place Order Scenario demonstrates three common fragments:
looprepeats the enclosed interaction while a guard holds. Here, the work occurs for each order item.altrepresents mutually exclusive paths. Here, a VIP member triggers courier dispatch, while an ordinary member triggers mail dispatch.optrepresents a single optional path. Here, notification occurs only when confirmation is needed.
For the parking exit flow, use an alt fragment only if the interviewer asks you to show error behavior or if ticket validity is a stated requirement. A good version would appear immediately after findOpenTicket(ticketId):
| Guard | Behavior |
|---|---|
[ticket exists and is open] | Continue with duration calculation, pricing, closure, and spot release. |
[ticket missing or already closed] | Return an error such as TicketNotFound or TicketAlreadyClosed; do not quote a fee or release a spot. |
The guards are business conditions, not code syntax. They should tell the reader why the flows differ.
Avoid fragment misuse
Some common interview mistakes are worth avoiding:
- Do not use
altfor every small validation inside a method. Keep private implementation checks inside the class unless they alter external collaboration. - Do not use
loopmerely because a method might be called again later. A loop should represent repetition within this scenario. - Do not use
parmerely because two requests feel independent. Use it only when the operations may genuinely proceed concurrently and their ordering does not matter to correctness. - Do not place a notification call on the core path unless the user must wait for notification delivery before the use case is successful.
For example, after the ticket is closed, an email receipt could be modeled as an asynchronous event. But that is a separate concern from the essential exit interaction. In an interview, mention it briefly rather than adding it immediately:
“After the exit commits, the service can publish a
ParkingExitedevent for asynchronous receipt delivery. I am leaving that out of the core sequence because it does not determine whether the vehicle may exit.”
A fast interview method for drawing sequence diagrams
When asked to trace a use case, aim to produce a first coherent version in roughly five to seven minutes.
-
State the scope and assumption.
For example: “I will model the successful vehicle-exit flow for an active ticket; payment and email receipt delivery are out of scope.” -
Write the actor and three to five essential lifelines.
Begin with the actor at the left. Order participants so the expected calls mostly progress left to right. -
Draw the primary successful messages first.
Use meaningful operation names and show important arguments or outcomes. -
Add significant replies.
Emphasize data that enables the next decision, such asticket,duration, andfee. -
Add activation bars only after the message order is sound.
They are useful polish, not the core design. -
Add one alternative flow if it changes the outcome materially.
For this scenario, a missing or closed ticket is enough. -
Cross-check against the class diagram.
Every important message should have an owner and a plausible operation in the static design.
A strong final explanation is concise:
“The service coordinates the request, but the ticket owns its own closing state and the pricing policy owns the variable fee algorithm. The ticket must be found and open before pricing begins. Once it is closed, the lot releases its associated spot and the service returns the receipt.”
That explanation demonstrates not only UML notation, but also cohesion, contracts, invariants, and dependency direction.
Key takeaways
A UML sequence diagram traces one runtime scenario through the objects defined by your class design.
- Time progresses from top to bottom; each lifeline represents one actor or object participating in the scenario.
- Use call messages for meaningful collaboration and reply messages for results that matter to the subsequent flow.
- Let the sequence diagram validate responsibility boundaries: coordinators orchestrate, domain objects change their own state, and policies provide variable behavior.
- Begin with the normal success path. Add
alt,opt, andloopfragments only when a requirement introduces a meaningful branch, optional step, or repetition. - Keep the diagram at one abstraction level and scoped to a single use case.
- In an LLD interview, ensure every important message corresponds to a defensible class or interface contract.
This completes the Low-Level Design Foundations module. Next, you will begin applying named patterns, starting with the Strategy pattern—the same design idea behind keeping PricingPolicy interchangeable rather than embedding every fee rule inside ParkingService or ParkingTicket.
Can't find a good explanation? Sign up and we'll make it for you
Sign up