Modeling Relationships

Entities by themselves aren’t much use. Most models will need to connect entities of different types to create relationships in the data, like the foreign keys in a SQL database.

An entity can use three main techniques to refer to another entity: nesting, identifiers, and stateful references. All of these techniques have analogues in other languages (and databases), but Clojure users prioritize the use of these techniques differently than in other languages. Languages like Java rely heavily on stateful references from one mutable object to another. Clojure users use the nesting and identifier techniques first and fall back to stateful references only in special cases.

Nesting simply means including another entity directly ...

Get Clojure Applied now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.