- 1Use Case Diagram in UML | Beginner's Guide with Java and Real-World Examples
- 2Activity Diagram in UML | Java-Centric Beginner's Guide with Real Examples
- 3Sequence Diagram in UML | Step-by-Step Java Guide with Real-World Examples
- 4UML Communication Diagram | Java-Based Tutorial with Real-Life Examples
- 5UML State Machine Diagram | Java-Centric Tutorial with Real Examples
- 6UML Interaction Overview Diagram | Java Tutorial with School-Based Examples
- 7UML Timing Diagram | Java Tutorial with Real-World Timing Examples


- 1Class Diagram in UML | Beginner-Friendly Guide with Examples
- 2Object Diagram in UML | Simple, Visual Examples for Beginners
- 3Component Diagram in UML | Beginner-Friendly Tutorial with Java Examples
- 4Deployment Diagram in UML | Beginner’s Guide with Examples and Java Use Cases
- 5Package Diagram in UML | Java-Focused Tutorial with Real Examples
- 6Composite Structure Diagram in UML | Java Examples & Complete Guide for Beginners

- 1Use Case Diagram in UML | Beginner's Guide with Java and Real-World Examples
- 2Activity Diagram in UML | Java-Centric Beginner's Guide with Real Examples
- 3Sequence Diagram in UML | Step-by-Step Java Guide with Real-World Examples
- 4UML Communication Diagram | Java-Based Tutorial with Real-Life Examples
- 5UML State Machine Diagram | Java-Centric Tutorial with Real Examples
- 6UML Interaction Overview Diagram | Java Tutorial with School-Based Examples
- 7UML Timing Diagram | Java Tutorial with Real-World Timing Examples

- 1UML Relationships in Java: Association, Aggregation, Composition Explained with Examples
- 2UML Inheritance and Generalization | Java Examples for Beginners
- 3Interfaces vs Abstract Classes in UML with Java Examples
- 4Multiplicity and Navigability in UML – Easy Guide with Real-Life Examples
- 5Constraints and Notes in UML – Beginner-Friendly Guide with Java Examples

- 1UML in Software Development Lifecycle (SDLC) – Complete Guide with Examples
- 2How to Create UML Diagrams from Requirements – Step-by-Step with Examples
- 3UML and Agile: A Practical Guide for Beginners
- 4Case Study: UML for an E-commerce Application – Step-by-Step UML Design
- 5UML Best Practices and Common Mistakes – A Beginner’s Guide with Examples


- 1Quiz: UML Concepts – Test Your Understanding of UML Diagrams and Principles
- 2Practical Assignment: UML Modeling – Step-by-Step UML Design Task for Java Beginners
- 3UML Review and Feedback – How to Evaluate and Improve UML Models in Java Projects
- 4UML Certificate of Completion – How to Earn and Use Your Certification
Use Case Diagram in UML
Next Topic ⮕Activity Diagram in UML | Java-Centric Beginner's Guide with Real Examples
Introduction
Before a single line of Java code is written, there's one essential question every developer must answer: What should the system do? That’s where Use Case Diagrams come in.
In UML, a Use Case Diagram is a visual tool that describes the functional requirements of a system — what the system should do from the perspective of an end user or external system. It’s simple, clear, and incredibly useful, especially at the early stages of software development.
What is a Use Case Diagram?
A Use Case Diagram shows the interactions between actors (users or external systems) and use cases (specific functionalities or goals). It defines the who and the what of a system, not the how.
It’s a bird’s-eye view of the system's functionality — one that helps both technical and non-technical stakeholders stay aligned.

Why Use a Use Case Diagram?
- Gather requirements: Captures user needs clearly
- Align stakeholders: Bridges business and development teams
- Scope planning: Defines the system’s boundaries
- Test case foundation: Serves as a basis for designing test scenarios
Key Elements of Use Case Diagrams
1. Actor
Anything that interacts with the system from the outside — a user, another system, or a device. Represented as a stick figure.
Actor: Student, Teacher, Admin
2. Use Case
An action or goal the actor wants to achieve. Represented as an oval.
Use Cases: Register, Upload Marks, View Report
3. System Boundary
A rectangle that defines the scope of the system. Use cases go inside; actors stay outside.
4. Relationships
- Association: Solid line connecting actor to use case
- Include (<
>): Common functionality used by multiple use cases - Extend (<
>): Optional or conditional behavior - Generalization: Inheritance between actors or use cases

Real-World Example: School Management System
Actors
- Student: Wants to view marks, register for exams
- Teacher: Uploads marks, views schedule
- Admin: Adds subjects, assigns teachers
Use Cases
- Login
- View Marks
- Register for Exam
- Upload Marks
- Manage Schedule
- Assign Subjects
Use Case Diagram
This diagram illustrates how actors interact with the system’s key functionalities:

Java Analogy
// Actor interaction mapped to controller method
@GetMapping("/view-marks")
public String viewMarks(@RequestParam int studentId) {
return markService.getMarks(studentId);
}
Here, viewMarks
is a use case in the diagram and implemented as a Java method in the backend.
Step-by-Step: How to Draw a Use Case Diagram
Step 1: Identify Actors
Ask: Who will use or interact with the system? Don’t forget external systems or devices.
Step 2: List Use Cases
What do these actors want to accomplish? Focus on goals, not implementation.
Step 3: Draw the System Boundary
Create a rectangle and name it after the system, like School System
.
Step 4: Place Actors Outside, Use Cases Inside
Draw stick figures for actors, and connect them to use cases with solid lines.
Step 5: Add Relationships
Use <<include>>
for shared logic and <<extend>>
for optional steps.
Use Case Relationship Examples
Include
Login is included in most flows:
Student --> (Register for Exam)
(Register for Exam) --> (Login) <<include>>
Extend
Viewing detailed feedback may extend the basic view marks feature:
(View Marks) --> (View Feedback) <<extend>>

Common Mistakes to Avoid
- Focusing on UI instead of behavior
- Modeling implementation details instead of goals
- Forgetting external actors like payment gateways or reporting services
- Overcomplicating with too many details
Best Practices
- Use clear actor names: Avoid generic labels like "User"
- Stick to user goals: Use cases should express what the user wants
- Group related use cases: Helps simplify large diagrams
- Complement with narratives: Add textual descriptions for each use case
Tools for Creating Use Case Diagrams
- StarUML: Drag-and-drop actors and use cases
- Lucidchart: Collaborative and easy to share with stakeholders
- PlantUML: Perfect for text-based diagram generation
- draw.io: Free and intuitive for quick modeling
PlantUML Example
@startuml
actor Student
actor Teacher
actor Admin
rectangle "School System" {
(Login)
(View Marks)
(Register for Exam)
(Upload Marks)
(Assign Subjects)
Student --> (Login)
Student --> (View Marks)
Student --> (Register for Exam)
Teacher --> (Login)
Teacher --> (Upload Marks)
Admin --> (Assign Subjects)
}
@enduml

Conclusion
Use Case Diagrams are one of the easiest ways to start modeling a system. They strip away technical complexity and focus on what really matters — what the system does for its users. Whether you’re gathering requirements, presenting to stakeholders, or preparing to implement in Java, use case diagrams help you stay aligned and focused on delivering value.
In the next lesson, we’ll zoom into the interactions themselves — using Sequence Diagrams to model message flows over time.
QUIZ
Question 1:What is the primary goal of a Use Case Diagram in UML?
Question 2:An actor in a Use Case Diagram must always represent a human user.
Question 3:Which of the following are valid elements of a Use Case Diagram?
Question 4:In the context of a school management system, which of the following is MOST likely a use case?
Question 5:An 'include' relationship in a Use Case Diagram means that one use case always requires another to complete its behavior.
Question 6:Which of the following scenarios best represent an 'extend' relationship?
Question 7:How is a use case typically represented in UML diagrams?
Question 8:Generalization relationships between actors allow one actor to inherit interactions from another.
Question 9:In a library system, which of these could be valid actors?
Question 10:Consider this real-world situation:
// A teacher can either grade or review assignments
// Grading optionally includes feedback
Which Use Case Diagram relationship does 'includes feedback' represent?
// A teacher can either grade or review assignments
// Grading optionally includes feedback