Visualizing Object Interactions with UML Sequence Diagrams

UPI Study › Courses › Software Engineering › Free lessons › Lesson 7.6 Free with a free account

Visualizing Object Interactions with UML Sequence Diagrams

Software Engineering · Chapter 7: Behavioral Models and Requirements AnalysisSection 7.6 · lesson 52 of 1036 min · free with a free account

← Handling Requirements for Web-Based ApplicationsNext lesson: How the Software Design Process Works →

Earn 3 college credits for Software EngineeringRecommended for credit by NCCRS · Computer Science 301 · self-paced · one payment, lifetime access

In this lesson

What actually happens, step by step, when the system runs.

  • Explain what a sequence diagram shows
  • Identify objects, lifelines, activation bars, and messages
  • Distinguish a synchronous message from a return message
  • Read a complete sequence diagram in time order

Transcript

Everything said in the video, section by section (763 words). Read along, or search it.

Behavioral Models and Requirements Analysis

Visualizing Object Interactions with UML Sequence Diagrams

A context diagram shows what crosses a system's boundary. A class diagram shows what a system is built from. But how does anyone show what actually happens, step by step, when the system runs? This section covers the U M L sequence diagram. Its building blocks, its two main message types, and how to read one in time order.

Behavior, Not Structure

1 Scenario, Played Out

A sequence diagram shows a specific interaction unfolding over time. It shows which objects are involved, what messages pass between them, and in what order those messages occur. A class diagram shows structure, what pieces exist and how they relate. A sequence diagram shows behavior, one particular scenario, played out step by step. That scope is deliberately narrow. It captures one interaction at a time, such as placing an order or logging in. That way, the exact sequence of messages in that one scenario can be read clearly from top to bottom.

Table 1

4 Building Blocks

Every sequence diagram is built from four elements. An object, or participant, is a labeled box at the top. It is one of the objects taking part in the interaction. A lifeline is a dashed vertical line below each object, showing its presence over the course of the interaction. An activation bar is a narrow rectangle on a lifeline. It shows the span of time when that object is actively processing. And a message is a horizontal arrow between two lifelines, showing one object calling, or responding to, another.

Figure 1

Placing an Order

Here is a sequence diagram for placing an order. Three objects sit across the top. The customer, the order system, and the payment gateway. Each has a dashed lifeline running down. The solid arrows are calls. The customer calls submit order, and the order system calls charge payment. The dashed arrows are returns. Payment approved comes back from the gateway, and order confirmed goes back to the customer. And the narrow bars show which objects are busy, and when.

Reading Figure 1

Time Runs Top to Bottom

Every sequence diagram reads the same way. Time moves from top to bottom. First, the customer calls submit order on the order system. Second, the order system calls charge payment on the payment gateway. Third, the gateway returns payment approved. And fourth, the order system replies to the customer with order confirmed. A message drawn higher happens before a message drawn lower, whichever objects are involved.

Message Types

Calls and Returns

Not every arrow means the same thing. A synchronous message is a solid line with a filled arrowhead. The sender calls the receiver, and waits for that call to finish before doing anything else. A return message is a dashed line, also with a filled arrowhead. It hands back the value or result once the call completes. In this diagram, submit order and charge payment are the calls, moving the interaction forward. Payment approved and order confirmed are the returns, unwinding back through the same chain of calls.

Activation Bars

Who Is Busy, and For How Long

Look at the activation bars. The order system's bar begins the moment it receives submit order, and does not end until it sends order confirmed back to the customer. It stays active the whole time, even while waiting on the payment gateway, because it is responsible for completing the scenario. So why is the payment gateway's bar so much shorter? Because the gateway is only active while it is handling charge payment. Once it sends back payment approved, its part in the interaction is finished.

Apply It

Adding a Logging Step

Let's apply that. Suppose the order system must log the completed order, after receiving payment approved, but before replying to the customer. Where does that new message go on the diagram? Between the payment approved return and the order confirmed return. Time flows top to bottom, and that is exactly when the logging happens.

Key Terms

The Vocabulary of This Section

Let's lock in the key terms. A sequence diagram shows one specific interaction over time, including which objects are involved, what messages pass between them, and in what order. A lifeline is the dashed vertical line below an object, and an activation bar is the narrow rectangle showing when it is actively processing. A synchronous message is a solid line with a filled arrowhead, representing a call the sender waits on. And a return message is a dashed line with a filled arrowhead, representing a result sent back once a call completes.

Key Takeaways

What to Carry Forward

To pull this together. A sequence diagram shows one specific interaction over time, rather than a system's overall structure. Its four elements are objects, lifelines, activation bars, and messages. Time flows from top to bottom, so a message drawn higher happens earlier. And solid arrows are calls the sender waits on, while dashed arrows are the results sent back.

About Software Engineering at UPI Study

Software Engineering (Computer Science 301) is a self-paced online course of 103 video lessons in 15 chapters, from process models and agile to requirements, design, user interfaces, reliability, security and project management. It carries a NCCRS credit recommendation for 3 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Compare: Software Engineering vs Systems Analysis

Why take it here

Why students take Software Engineering with UPI Study

How professional software gets builtSoftware Engineering covers how teams turn requirements into working, maintainable software: process models, agile, requirements, design, testing, reliability and project management. It is a core course in computer science and software degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Software Engineering carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Visualizing Object Interactions with UML Sequence Diagrams

What does a UML sequence diagram show?
A UML sequence diagram shows one specific interaction unfolding over time: which objects take part, what messages pass between them, and in what order. Where a class diagram shows structure, a sequence diagram shows behavior for a single scenario, such as placing an order or logging in. Keeping the scope to one scenario lets the exact order of messages be read clearly from top to bottom.
What are lifelines and activation bars in a sequence diagram?
A lifeline is the dashed vertical line below each participating object, showing its presence over the course of the interaction. An activation bar is a narrow rectangle on a lifeline showing when that object is actively processing. In an order example, the order system's bar runs from receiving submit order until it sends order confirmed, while the payment gateway's bar is short because it is active only while handling the charge.
What is the difference between a synchronous message and a return message in UML?
A synchronous message is a call drawn as a solid line with a filled arrowhead, and the sender waits for it to finish before doing anything else. A return message is drawn as a dashed line and hands back the result once the call completes. In an order scenario, submit order and charge payment are calls that move the interaction forward, while payment approved and order confirmed are returns unwinding back through the chain.
How do you read a sequence diagram in the right order?
Read it from top to bottom, because time flows downward, so a message drawn higher happens before one drawn lower regardless of which objects are involved. For placing an order, the customer calls submit order, the order system calls charge payment, the gateway returns payment approved, and the order system returns order confirmed. A new step, such as logging the order, goes exactly where it happens in that timeline.

About the Software Engineering course

How many college credits is Software Engineering?
Software Engineering (Computer Science 301) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Software Engineering cost and what is included?
$250, paid once, with lifetime access: all 103 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Software Engineering take?
It is self-paced with no deadlines. The 103 lessons total about 11 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 3 credits in Software Engineering.

103 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Software Engineering
3 credits · NCCRS
Enroll →