UPI Study › Courses › System Analysis and Design › Free lessons › Lesson 4.4 Free with a free account
Getting Started with Use Case Diagrams, Documents, and Templates
System Analysis and Design · Chapter 4: Requirements Validation, Modeling, and UMLSection 4.4 · lesson 27 of 698 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 System Analysis and Design.
Lesson complete
Earn the 3 college credits for System Analysis and Design
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Data Flow Diagrams: How Data Moves Through a System →← UML Models Unpacked: Design Patterns and Practical CasesNext lesson: Data Flow Diagrams: How Data Moves Through a System →
In this lesson
Sketching use cases, documenting them in full, and comparing them with user stories.
- Identify actors, use cases, and the system boundary in a use case diagram
- Distinguish the include, extend, and generalization relationships
- Write a use case narrative with pre- and postconditions, main and alternate flows
- Compare use cases with user stories, and choose between them
Transcript
Everything said in the video, section by section (1,166 words). Read along, or search it.
Requirements Validation, Modeling, and UML
Use Case Diagrams, Documents, and Templates
Earlier in the course, use cases came up briefly. This section teaches them properly. We will cover the diagram notation used to sketch use cases at a glance. The written template used to document one in full detail. And how the technique compares with the shorter user story format, common in agile work.
What a Use Case Is
Value, Seen From Outside
A use case describes a way a system delivers value to someone outside it. And it is told from that person's point of view, rather than the system's internal logic. That perspective is the whole point. A use case is not about how the system works inside. It is about what someone outside can accomplish with it. Use cases come in two forms. A diagram sketches many use cases at a glance. And a written narrative documents one use case in full detail.
Figure 1
Actors, Use Cases, and the System Boundary
Here is a basic use case diagram, for an online banking system. On the left is an actor, drawn as a stick figure. This one is the customer. The rectangle is the system boundary. Everything inside it is part of the system being built. Inside it are three use cases, drawn as ovals. View balance, transfer funds, and pay bill. Plain lines, called associations, connect the actor to each use case it takes part in. Notice the placement rule. Actors always sit outside the boundary. Use cases always sit inside it. That echoes the context diagram from earlier in this chapter. The boundary separates what you build from who uses it.
The Notation
4 Elements
Let's name the four elements precisely. An actor, drawn as a stick figure, represents anyone or anything outside the system that interacts with it. Typically that is a type of user, but sometimes it is another system. A use case, drawn as an oval, names one specific goal the actor can accomplish using the system. The system boundary, drawn as a rectangle, marks what is inside the system, and what is outside it. And an association, a plain line, connects an actor to a use case it participates in. Four simple shapes. That simplicity is why stakeholders with no technical background can read these diagrams.
Figure 2
Include, Extend, and Generalization
Beyond simple associations, three more relationships connect use cases to each other. The first is include. A base use case always performs an included use case, as part of its own flow. The arrow points from the base to the included use case. For example, transfer funds always includes verify account. The second is extend. An extending use case adds optional behavior to a base use case, but only under certain conditions. Here the arrow points the other way, from the extension to the base. For example, schedule recurring payment extends pay bill, only when the customer chooses that option. The third is generalization. A child use case is a specialized version of a more general parent. It is drawn with a hollow triangle, pointing from child to parent. Pay by card, and pay by bank transfer, both generalize to make payment.
Documenting in Full
The Use Case Narrative Template
A use case diagram shows that a use case exists. It does not show what actually happens inside it. The narrative template captures that detail. And it does so in a standard structure, so any use case is documented the same way, whoever writes it. It has four sections. Preconditions state what must already be true before the use case can begin. The main flow is the numbered sequence of steps followed when everything goes as expected. Alternate flows are numbered variations, tied to a main-flow step, that handle exceptions or choices. And postconditions state what must be true once the use case finishes successfully.
Worked Example (1 of 2)
Use Case: Transfer Funds
Here is a complete narrative, for transfer funds. The precondition. The customer is logged in, and has at least one active account. Now the main flow. Step one, the customer selects transfer funds. Step two, the system displays the customer's accounts, and their balances. Step three, the customer selects a source account, a destination account, and an amount. Step four, the system verifies the source account. That step is exactly the include relationship we just saw. Transfer funds includes verify account. Step five, the system transfers the amount, and displays a confirmation.
Worked Example (2 of 2)
When Things Go Differently
Now the alternate flows, where things go differently. Alternate flow three A. The customer enters an amount greater than the source account balance. The system displays an error, and returns to step three. Alternate flow four A. Account verification fails. The system displays an error, and cancels the transfer. Notice the numbering. Each alternate flow is tied to the main-flow step it branches from. Finally, the postconditions. The source account balance is decreased, and the destination balance increased, by the transferred amount. Those postconditions are also a ready-made test. After a successful transfer, both balances must have moved by exactly that amount.
2 Formats
Use Cases vs. User Stories
How does a use case compare with a user story? A user story is a short, one- or two-sentence statement of a need. It usually takes the form, as a type of user, I want a goal, so that a benefit. It captures the same underlying idea as a use case, but at a much smaller scale. A use case is a full narrative, with preconditions, flows, and postconditions. A user story is a single sentence, often expanded later with acceptance criteria. Use cases suit complex, regulated, or safety-critical workflows. User stories suit iterative, fast-moving projects, where scope shifts often. Use cases are usually written by an analyst, and often reviewed formally. User stories are often written by the whole team, together. And use cases capture exceptions explicitly, in alternate flows. User stories usually handle exceptions as separate stories. Neither format is strictly better. Many teams use user stories for day-to-day planning, and reserve full use cases for workflows complex or risky enough to need the detail.
Key Terms
The Vocabulary of This Section
Let's lock in the key terms. An actor is someone or something outside the system that interacts with it, drawn as a stick figure. A use case is a specific goal the actor can accomplish, drawn as an oval. The system boundary is the rectangle marking what is inside the system. An include relationship is always performed. An extend relationship adds optional behavior, under certain conditions. Generalization shows a child use case as a specialized version of a parent. A use case narrative documents preconditions, the main flow, alternate flows, and postconditions. And a user story states a need, as a user, I want a goal, so that a benefit.
Key Takeaways
What to Carry Forward
To pull this together. A use case diagram has three core elements. Actors outside the system, use cases inside it, and the system boundary between them. Include means the base use case always performs the included one. Extend means the extension runs only under certain conditions. Generalization, drawn with a hollow triangle, shows a child use case as a specialized version of a parent. A use case narrative documents preconditions, a main flow, alternate flows, and postconditions, in a standard structure. And use cases suit complex or regulated workflows, while user stories suit fast-moving, iterative work.
About System Analysis and Design at UPI Study
System Analysis and Design (Computer Science 390) is a self-paced online course of 69 video lessons in 9 chapters, from the analyst's role and requirements to UML modeling, interface and database design, testing, maintenance 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 System Analysis and Design with UPI Study
Where the credit goes
Universities that work with NCCRS
System Analysis and Design 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 Getting Started with Use Case Diagrams, Documents, and Templates
What are the main elements of a use case diagram?
What is the difference between include and extend in a use case diagram?
What goes into a use case narrative template?
When should you use a use case instead of a user story?
About the System Analysis and Design course
How many college credits is System Analysis and Design?
How much does System Analysis and Design cost and what is included?
Which universities accept UPI Study credits?
How long does System Analysis and Design take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in System Analysis and Design.
69 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
3 credits · NCCRSEnroll →