Modeling Entities

Any programming effort starts with a problem we want to solve. The first task we face is how to model the domain of the problem to express our solution. The decisions we make will affect how we interact with external systems as well as the algorithms and performance of our application. We’ll start by considering how we should represent domain entities in Clojure.

In Clojure, we use either maps or records to represent domain entities. Maps are generic collections of key-value pairs, whereas records construct a type with predefined structure for well-known fields.

We’re going to look at a number of considerations involved in choosing between maps and records based on expected usage patterns and performance needs. But let’s start ...

Get Clojure Applied now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.