← Back to list

A Quick Guide to UML Class Diagrams

1. Class Block

Om Sai Krishna Madhav Lella · 2025-06-27 12:50 · 3 claps · 2.1 min read
#uml #class-diagram #design-systems #object-oriented-design #quick-guide
Open on Medium ↗
Wiki topics: PRD · Product Design

A Quick Guide to UML Class Diagrams

1. Class Block

A class is represented as a rectangle with three compartments: the first for the name, the second for the attributes, and the third for the methods.

2. Attributes and Operations

Inside the class block, list data as field: Type and behavior as method(params): ReturnType.

3. Visibility and Modifiers

Use + for public, ~ for package (default), # for protected, — for private, underline static members, and italicize abstract ones.

4. Association

A solid line shows a persistent link between instances, and add role names if helpful.

5. Multiplicity

Quotes on the line ends express “how many.”

Here, the class diagram indicates that a customer can place zero or more orders.

6. Inheritance (Generalization)

Open arrow means is-a. Subclasses inherit all attributes and operations.

7. Interface Realization

Mark a contract with <<interface>>, and a class realizes it via a dashed open arrow <|..

8. Aggregation vs. Composition

  • Aggregation is represented by o — and it means parts may live on
  • Composition is represented by *and it means parts die with the whole

9. Dependency

A dashed arrow ..> marks a temporary collaboration: one class needs another only while a method runs, never storing it afterward

Keep diagrams small, focus on relationships, and update them during code reviews. With these nine patterns, you can sketch most designs.


메타데이터
post_id
dd70eab652fa
slug
a-quick-guide-to-uml-class-diagrams-dd70eab652fa
url
https://medium.com/@omsaikrishnamadhav.lella/a-quick-guide-to-uml-class-diagrams-dd70eab652fa
canonical_url
https://medium.com/@omsaikrishnamadhav.lella/a-quick-guide-to-uml-class-diagrams-dd70eab652fa
author_url
https://medium.com/@omsaikrishnamadhav.lella
status
ok
fetched_at
2026-08-07 21:16:54