O'Reilly logo

Clojure Applied by Alex Miller, Ben Vandgrift

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required