Skip to content
Dev Dump

UML Design

UML (Unified Modeling Language) is the industry-standard language used in software engineering for Object-Oriented Analysis and Design (OOAD).

It acts as a blueprint for software systems, enabling developers, architects, and stakeholders to visualize, specify, construct, and document complex architectures before writing a single line of code.

UML consists of over 13 diagram types, broadly categorized into two groups:

  1. Structural Diagrams: Visualize the static, architectural layout of the system (e.g., Class Diagram, Component Diagram).
  2. Behavioral Diagrams: Visualize the dynamic execution and flow of the system over time (e.g., Use Case, Sequence Diagram).

UML Diagram Types Hierarchy showing the split between static (Structural) and dynamic (Behavioral) modeling.


A Class Diagram represents the static structure of an object-oriented system. It models the classes, their attributes (data), operations (methods), and the logical relationships between them.

Class diagrams translate almost perfectly into OOP code (Java, C++, TypeScript).

ElementDescriptionCode Equivalent
ClassThe blueprint or template for objects.class Car { ... }
AttributeProperties, states, or data members.private String color;
MethodFunctions, behaviors, or operations.public void start();

Class Diagram Example A standard class box showing visibility markers (+ for public, - for private).


Understanding how objects relate to one another is the core of LLD. UML provides specific notations for different types of “Has-a” and “Knows-a” relationships.

A “Has-a” relationship where the child object’s lifetime is tightly bound to the parent object.

If the parent is destroyed, the child is also destroyed. The child cannot exist independently.

  • Notation: A solid, filled diamond on the parent’s side.

Composition Relationship A House strictly owns its Rooms. You cannot have a Room floating in the void without a House.

A “Has-a” relationship where the child has an independent lifecycle.

The parent contains the child, but if the parent is destroyed, the child objects continue to exist.

  • Notation: A hollow diamond on the parent’s side.

Aggregation Relationship A Team aggregates Players. If the Team disbands, the Players still exist and can join other teams.

A “Knows-about” relationship. One class uses or interacts with another, but the interaction flows in one direction only.

  • Notation: A solid line with an open arrow pointing to the known class.

Unidirectional Association A Customer places an Order. The Customer object maintains a reference to the Order, but the Order object has no programmatic link back to the Customer.

Two classes are mutually aware of each other. Both classes maintain a reference to the other.

  • Notation: A simple solid line without any arrows.

Bidirectional Association A Teacher knows their Students, and the Students know their Teacher. Modifying one side usually requires updating the other to maintain consistency.