AlgoViz

Finding entities and owners

medium 35 min

A spec is full of nouns, and most of them are not classes.

Watch lesson4:50

Where it shows up

The same pattern appears across everyday software.

  • Django

    A many-to-many relation can have an intermediate model, named with `through`. It holds extra fields of the link, such as the date somebody joined a group. A verb that became a class.

  • Git

    A blob stores only contents. The file name is in the tree that lists it. The name belongs to the place and not to the contents.

  • Stripe

    A PaymentIntent follows one payment from creation through checkout, with a status that changes over its life. An entity, where a pair of card and amount would not do.

  • Kubernetes

    Dependent objects carry an owner reference to the object that owns them. The documentation says that this helps parts of the system not to interfere with objects they do not control.

  • java.time.LocalDate

    Documented as a value-based class: equal instances should be treated as interchangeable, and not be used for locking.

  • Python pathlib

    Pure paths compute with names and touch no disk. Concrete paths add input and output. A value and something that acts, kept apart.

  • Rust

    Each value has an owner, there can only be one at a time, and the value is dropped when the owner goes out of scope. The compiler checks what this page asks you to write down.

  • Qt

    A QObject with a parent is deleted when the parent is. Composition as a rule of the library: a message box takes its buttons with it.

  • Google Calendar API

    Attendees are a list inside the event, with facts per attendee such as additional guests. A link with facts, owned by one side.