Extending and Including Use Cases Effectively
When modeling user interactions in software, reusing common behaviors across multiple use cases is essential. That’s where <
Think of <
Here, you’ll learn how to apply these relationships with real-world logic, avoid common mistakes, and craft diagrams that others can actually understand. I’ll share patterns I’ve used in production systems and warn you about the pitfalls that can derail your modeling early on.
Understanding <>: Reusing Common Functionality
Use <
For example, in a payment processing system, the “Process Payment” use case might <
Use <
- The included use case is required for the base use case to complete.
- You have overlapping steps across multiple use cases (e.g., login, data validation).
- You want to isolate complex behavior into a single reusable component.
Don’t use <
When <> is the Right Choice
Consider a hospital appointment system. The use case “Schedule Appointment” must always include “Check Doctor Availability” and “Validate Patient Records.” These are not optional—they’re prerequisites.
Here’s how to draw it:
- Draw the base use case (e.g., “Schedule Appointment”).
- Draw the included use case (e.g., “Check Doctor Availability”).
- Connect with a dashed line labeled «include».
- Use a dashed arrow pointing from the base to the included use case.
Remember: <
Understanding <>: Adding Optional or Conditional Behavior
Use <
For example, in an online shopping app, “Place Order” might <
Use <
- The behavior is optional and only applies under certain conditions.
- You need to model alternative paths (e.g., success vs. error handling).
- The extension depends on a specific event or user decision.
Never use <
When <> is the Right Choice
Imagine a login system. The base use case is “Login.” You can <
Here’s how it works:
- Draw the base use case (“Login”).
- Draw the extension use case (“Send Two-Factor Code”).
- Connect with a dashed line labeled «extend».
- Use a dashed arrow from the extension to the base use case.
- Mark the extension with a «extend» stereotype.
Now, the extension only triggers under a defined condition—like a guard on a decision node.
Use Case Extend vs Include: Key Differences
Confusion between <
| Aspect | <<include>> |
<<extend>> |
|---|---|---|
| Relationship Type | Mandatory inclusion | Optional extension |
| Direction | Base → Included | Extension → Base |
| When Used | Shared, required steps | Conditional, optional flows |
| Example | “Process Payment” < |
“Place Order” < |
Remember: if it’s required and repeated, use <
Guidelines to Avoid Clutter and Maintain Clarity
Overusing <
- Limit extensions to 2–3 per use case. More than that, and the diagram becomes unwieldy. If you need more, consider splitting the use case or creating a new one.
- Use <
> only for truly reusable logic. Don’t break down simple steps like “Enter Name” into a separate use case unless it’s repeated across 3+ use cases. - Never nest <
> relationships. A use case shouldn’t <> another < >. If the dependency is complex, use a generalization or separate use case. - Label conditions clearly. When using <
>, always specify the condition in a note or as a guard on the extension. - Use stereotypes consistently. Always write «include» and «extend» in lowercase with angle brackets to distinguish them from regular text.
Clarity is more important than completeness. A clean, focused diagram that captures the core logic is worth more than a cluttered one that tries to include every possible variation.
Practical Example: Online Shopping Use Case
Let’s walk through a real-world example to see <
Base Use Case: “Place Order”
- Must <
> “Verify Cart” and “Confirm Shipping Address”. - May <
> with “Apply Discount Coupon” or “Request Gift Wrapping”.
The diagram remains readable because:
- Required steps are grouped via <
>. - Optional features are clearly marked as <
>. - Each extension has a defined condition (e.g., “if user has coupon”).
This structure makes it easy for developers to understand the flow and for business analysts to validate requirements.
Advanced Use Case Relationships Beginners Often Misunderstand
Many beginners think <
Ask yourself:
- “Is this step required for the use case to succeed?” → Use <
>. - “Is this step optional, dependent on a condition, or triggered by an event?” → Use <
>.
Another pitfall: overusing <
Always ask: Could the base use case work without this component? If not, <
Frequently Asked Questions
When should I use <> vs <>?
Use <
Can a use case both <> and <>?
Yes. A use case can have both. For example, “Process Order” might <
How do I show conditions for <> in a diagram?
Add a note near the <
Is <> the same as inheritance?
No. <
What’s the best way to avoid overusing <>?
Limit extensions to 2–3 per use case. If you have more, consider splitting the use case into smaller, focused ones. Also, evaluate whether the extension is truly optional or just a variation of the base flow.
Can <> be used for error handling?
Yes, but use it carefully. Error handling like “Handle Invalid Input” can <
Now that you’ve seen how <
Mastering these relationships is one of the first steps toward creating use case diagrams that not only look professional but actually guide development and communication.
Keep practicing. The more you draw, the faster you’ll spot the right pattern. And remember: clean diagrams are not about perfection—they’re about clarity.