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
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Software Engineering.
Lesson complete
Earn the 3 college credits for Software Engineering
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: How the Software Design Process Works →← Handling Requirements for Web-Based ApplicationsNext lesson: How the Software Design Process Works →
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.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Why take it here
Why students take Software Engineering with UPI Study
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.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →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?
What are lifelines and activation bars in a sequence diagram?
What is the difference between a synchronous message and a return message in UML?
How do you read a sequence diagram in the right order?
About the Software Engineering course
How many college credits is Software Engineering?
How much does Software Engineering cost and what is included?
Which universities accept UPI Study credits?
How long does Software Engineering take?
How are the exams done?
How do my credits reach my college?
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.
3 credits · NCCRSEnroll →