Subscription model
A subscription model with three notes: when a subscription renews, that plan prices are net, and that a card stores only a token. Each note is a pale box with a folded corner beside its class, joined by a dotted line that only says “explains” — it is no relation, so the structure stays the same. The description gives every note after the classes, the table a Notes column.
Subscription model
examples/subscription-model.json{
"schemaVersion": 1,
"type": "classes",
"title": "Subscription model",
"source": "Illustrative domain model",
"width": 900,
"height": 780,
"classes": {
"classes": [
{
"id": "customer",
"label": "Customer",
"attributes": [
"+ id: Int",
"+ email: String"
]
},
{
"id": "subscription",
"label": "Subscription",
"attributes": [
"+ startsOn: Date",
"+ renewsOn: Date"
],
"methods": [
"+ renew()",
"+ cancel()"
]
},
{
"id": "plan",
"label": "Plan",
"attributes": [
"+ name: String",
"+ monthly: Money"
]
},
{
"id": "invoice",
"label": "Invoice",
"attributes": [
"+ number: String",
"+ total: Money"
]
},
{
"id": "method",
"label": "PaymentMethod",
"kind": "interface",
"methods": [
"+ charge(amount: Money)"
]
},
{
"id": "card",
"label": "Card",
"attributes": [
"- token: String"
]
}
],
"relations": [
{
"from": "customer",
"to": "subscription",
"fromCardinality": "1",
"toCardinality": "0..*",
"label": "holds"
},
{
"from": "subscription",
"to": "plan",
"fromCardinality": "*",
"toCardinality": "1"
},
{
"from": "subscription",
"to": "invoice",
"kind": "composition",
"fromCardinality": "1",
"toCardinality": "0..*"
},
{
"from": "invoice",
"to": "method",
"kind": "dependency",
"label": "paid with"
},
{
"from": "card",
"to": "method",
"kind": "realization"
}
],
"notes": [
{
"on": "subscription",
"text": "Renews on the same day each month; a cancelled subscription runs to the end of its period."
},
{
"on": "plan",
"text": "Prices are net; tax is added on the invoice."
},
{
"on": "card",
"text": "Stores only a token from the payment provider, never the card number."
}
]
}
}Focus
Source: Illustrative domain model
Show chart data
| Item | Kind | Attributes | Methods | Relations | Notes |
|---|---|---|---|---|---|
| Customer | Class | + id: Int; + email: String | is associated with Subscription (1 : 0..*) [holds] | ||
| Subscription | Class | + startsOn: Date; + renewsOn: Date | + renew(); + cancel() | is associated with Plan (* : 1); is composed of Invoice (1 : 0..*) | Renews on the same day each month; a cancelled subscription runs to the end of its period. |
| Plan | Class | + name: String; + monthly: Money | Prices are net; tax is added on the invoice. | ||
| Invoice | Class | + number: String; + total: Money | depends on PaymentMethod [paid with] | ||
| PaymentMethod | Interface | + charge(amount: Money) | |||
| Card | Class | - token: String | implements PaymentMethod | Stores only a token from the payment provider, never the card number. |