Browse OOP reference
Modelling and persistence

What is UML?

On this page

The Unified Modeling Language is a standard notation for describing systems. A class diagram explains types and relationships, an object diagram depicts particular instances, and a sequence diagram shows interactions over time. Choose the view by the question. A class hierarchy alone cannot explain which call timed out.

Relationship diagram

InvoicelinesLineamountcontains 1..*

Worked example

Python
# Instance-level check for the association "Invoice 1 -- 1..* Line".
from dataclasses import dataclass

@dataclass(frozen=True)
class Invoice:
    lines: tuple[int, ...]
    def __post_init__(self):
        if not self.lines:
            raise ValueError("An invoice needs at least one line")

assert Invoice((25, 40)).lines == (25, 40)

OMG Unified Modeling Language specification

Explore class relationships in the OOP Playground

What are interfaces?How do modern languages approach object orientation?What is a method?

All OOP questions

Search ObjectFAQ