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
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)Explore class relationships in the OOP Playground