chartletv0.21.0chartlet.casoon.de

← All examples

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
Subscription model
Subscription modelClass diagram with 6 classes and 5 relations. Most connected: Subscription (3 connections). Bottleneck: Invoice; without it the diagram falls apart. Customer: 2 attributes, 0 methods. Customer is associated with Subscription (1 : 0..*) [holds]. Subscription: 2 attributes, 2 methods. Subscription is associated with Plan (* : 1); is composed of Invoice (1 : 0..*). Plan: 2 attributes, 0 methods. Invoice: 2 attributes, 0 methods. Invoice depends on PaymentMethod [paid with]. PaymentMethod: 0 attributes, 1 method. Card: 1 attribute, 0 methods. Card implements PaymentMethod. Note on Subscription: Renews on the same day each month; a cancelled subscription runs to the end of its period. Note on Plan: Prices are net; tax is added on the invoice. Note on Card: Stores only a token from the payment provider, never the card number.Customer → Subscription: holds0..*1Subscription → Plan1*Subscription → Invoice0..*1Invoice → PaymentMethod: paid withPaymentMethod → Cardholdspaid withCustomerCustomer+ id: Int+ email: StringSubscriptionSubscription+ startsOn: Date+ renewsOn: Date+ renew()+ cancel()PlanPlan+ name: String+ monthly: MoneyInvoiceInvoice+ number: String+ total: MoneyPaymentMethod – «interface»«interface»PaymentMethod+ charge(amount: Money)CardCard- token: StringRenews on the same day each month; a cancelled subscription runs to the end of its period.Renews on the same dayeach month; a cancelledsubscription runs to the endof its period.Prices are net; tax is added on the invoice.Prices are net; tax is addedon the invoice.Stores only a token from the payment provider, never the card number.Stores only a token fromthe payment provider, neverthe card number.

Source: Illustrative domain model

Show chart data
Data for Subscription model
ItemKindAttributesMethodsRelationsNotes
CustomerClass+ id: Int; + email: Stringis associated with Subscription (1 : 0..*) [holds]
SubscriptionClass+ 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.
PlanClass+ name: String; + monthly: MoneyPrices are net; tax is added on the invoice.
InvoiceClass+ number: String; + total: Moneydepends on PaymentMethod [paid with]
PaymentMethodInterface+ charge(amount: Money)
CardClass- token: Stringimplements PaymentMethodStores only a token from the payment provider, never the card number.
  • Class diagram with notes
  • Record rules a class box cannot show