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