UML & Use Case Diagrams

Discover why engineers use drawings over words. Master Use Case diagrams with real examples to communicate designs clearly in any interview.

April 22, 20265 min read1 / 8

I used to think that as long as I could write the code, I didn't need to draw it. But the first time I had to explain a complex system to a tech lead, I realized that words are messy. I’d say "service" and they’d hear "database." That’s when I discovered UML Diagrams -- the shared visual language that turns vague ideas into precise blueprints.

The Essentials

  1. UML is a shared drawing language so that every engineer draws the same shapes for the same ideas.
  2. Behavioral diagrams (like Use Cases) show what the system does from a user's perspective.
  3. Structural diagrams (like Class Diagrams) show how the code is built internally.
  4. Use Case Diagrams are the "menu" of features for your system.

Why Engineers Need to Draw Things

As a software engineer, writing code is only one part of the job. You spend a lot of time talking to tech leads, product managers, and teammates. In all of these conversations, you have two choices: words or drawings.

Words (emails, chats, meetings) are easy to write but very easy to misunderstand. Imagine telling someone "there's a service that handles users." Three engineers hear three completely different things. Words force the other person to build a picture in their own head, and they often get it wrong.

Drawings (diagrams, flowcharts, sketches) remove that guesswork. However, if everyone draws differently -- one using stars, another using circles -- confusion remains.

This is exactly the problem that UML (Unified Modeling Language) was created to solve. According to industry legend, serious IT people got fed up with the ambiguous variety of circles, dashes, stars, and clouds, and decided to create a standardized "best practice" for modeling complex systems.


What is UML?

UML stands for Unified Modeling Language. It is the worldwide standard for how software engineers define, design, visualize, and document their ideas. Think of it like a dictionary for drawings.

Unlike High-Level System Design where diagrams are often informal, UML 2.0 provides an integrated set of diagrams with agreed shapes and forms. It helps teams communicate, explore potential designs, and validate architectural choices before a single line of code is written.

Check out LLD Interview Types to see how UML fits into the actual design round.


The 14 Types of UML Diagrams

UML diagrams are split into two main families. While you won't use all of them every day, knowing the full "map" helps you choose the right tool for the job.

1. Structural Diagrams (The "What")

These describe the types of objects in the system and their static relationships.

  • Class Diagram: The heart of almost all OO methods.
  • Object Diagram: A concrete snapshot of the system at a specific moment.
  • Component Diagram: The architecture of software components and their dependencies.
  • Deployment Diagram: The physical aspect -- how software is distributed on hardware.
  • Package Diagram: How model elements are organized into modules or folders.
  • Composite Structure Diagram: The internal structure of a class and its runtime interactions.
  • Profile Diagram: Extension mechanism for specific domains (like Medical or Financial).

2. Behavioral Diagrams (The "How")

These show what the system does and how it reacts to events.

  • Use Case Diagram: The functional requirements from the user's view.
  • Activity Diagram: The workflow -- essentially an advanced flowchart.
  • State Machine Diagram: The lifecycle and permitted transitions of an object.
  • Sequence Diagram: Object interaction based on a time sequence.
  • Communication Diagram: Focuses on object collaborations rather than time.
  • Interaction Overview Diagram: A high-level flow between different interaction diagrams.
  • Timing Diagram: Intervals between state changes over a time axis.

For LLD Interviews and almost all real work, only two matter: Class Diagrams and Use Case Diagrams.


Part 1: The Use Case Diagram

A Use Case Diagram describes the functional requirements of a system. It is a model of intended functionality (Use Cases) and its environment (Actors). It links what we need from the system with how the system meets those needs.

The 5 Building Blocks

1. System Boundary (Rectangle)

Draw a big rectangle. For large systems, each module (like Payroll or Accounting) might be its own boundary. Everything inside is built by your team.

2. Use Case (Oval)

An oval representing a system function. A use case determines what should happen, not how. The name must be an action word (verb + noun).

  • Right: "Withdraw Cash", "Check Balance".

3. Actor (Stick Figure)

One who interacts with the system. An actor represents a role, not a specific person. A professor might play the role of "Lecturer" in one system and "Researcher" in another. Actors always stay outside the system boundary.

4. Includes (Dependency)

Includes means: "Use case A calls use case B to finish its job." It is used for common, reusable behavior.

  • Apply for Job includes Check Eligibility.

5. Extends (Variation)

Extends indicates optional behavior or specific variations.

  • Invalid Password extends Login.

[!TIP] Use Case Rule of Thumb If you have more than 20 use cases in a single diagram, you are probably going too deep. Use cases should start simple and move towards refinement only when needed.


Practical Advice: Clear Over Perfect

The goal of UML is not a "pretty picture" but a powerful tool to save your project from design flaws. If you can understand and utilize it properly - say, by drawing a class diagram before you code your next project - the time invested will pay off significantly.

Further Reading and Watching

While Use Case diagrams tell us what to build, they don't tell us how to build it. To see the actual attributes, methods, and relationships like Multiplicity and Aggregation, we need the Class Diagram. We'll master that in the next part.