Component & Deployment Diagrams

How does your code actually live? Master UML's physical diagrams to map out modular systems and hardware topologies like a pro.

April 22, 20263 min read4 / 8

Once you've mapped out your Use Cases and Class Diagrams, you might think you're done. But there's a big question left: How do these pieces actually fit together on a server? This is where we move from the logical design to the physical implementation using Component and Deployment Diagrams.

The Essentials

  1. Component Diagrams break a system into modular, high-level blocks of functionality.
  2. Provided & Required Interfaces (Lollipop and Socket) show how components "plug" into each other.
  3. Deployment Diagrams map software artifacts onto physical hardware nodes (servers, devices).

1. Component Diagrams: The Modular View

A Component Diagram is like a "high-level" version of a Class Diagram. Instead of looking at individual objects, we look at modular parts of the system that encapsulate their content. Each component is responsible for one clear goal and interacts with others only on a "need-to-know" basis.

Building Blocks

  • Component (Rectangle with Icon): A modular unit of the system. In UML 2.0, it's drawn as a rectangle, sometimes with optional compartments.
  • Provided Interface (The Lollipop 🍭): A full circle at the end of a line. This represents the service the component offers to the system.
  • Required Interface (The Socket 🕳️): A semicircle at the end of a line. This represents the service the component needs from somewhere else to do its job.
  • Ports (Small Square): Drawn on the edge of a component. Ports expose the required and provided interfaces to the outside world.

Why Use Them?

I found that Component Diagrams are incredible for Forward and Reverse Engineering. You can determine a set of source code files, model them as components, and then specify dependencies (like compilation order) between them. It turns a messy folder of code into a clear map of modules.

This is especially useful when following the LLD Interview Approach where you need to show how your solution scales across multiple modules.


2. Deployment Diagrams: The Physical Map

While Component Diagrams show what files exist, Deployment Diagrams show where they live. They model the configuration of runtime processing nodes and the software artifacts that live on them.

Unlike High-Level System Design where we talk about load balancers and CDNs, here we focus on exactly which server node hosts which software component.

Key Notation

  • Node (3D Box): Represents a piece of hardware (like a Server or Mobile Device) or an execution environment (like a Web Browser).
  • Artifacts: Specific physical elements (like a .jar file or a Database table) that result from the development process and are deployed onto nodes.
  • Connections: Lines showing how nodes communicate (e.g., via TCP/IP or HTTPS).

The "Pre-Deployment" Checklist

The transcript had a brilliant checklist that I now keep in my toolkit. Before you actually push to production, ask yourself:

  • Failure Points: Where could the installation fail?
  • Backups: What data do we need to save before we hit "Go"?
  • Data Conversion: Is the old data compatible with the new system?
  • Verification: How will we know the installation was successful?
  • Legacy Integration: What existing systems must the new one talk to?

Practical Advice: Clear Over Perfect

You don't need to model every single router or switch. If your system is fully distributed, you can just draw one big box labeled "Internet." The goal is to provide enough detail so your team (and your DevOps engineers) knows exactly where the artifacts go and how they talk to each other.

Further Reading and Watching

In the next part, we'll dive into Object and Package Diagrams to see how we organize our system at both the micro and macro levels.