Domain-Driven Design: Why There Is No Universal Model

Computer modeling exercise: If I asked you to model a table, what would you do?
…
Your first instinct should be to ask about the purpose. Indeed, the modeling will differ depending on whether:
- You’re an antique dealer and want to make sure this is indeed a Louis XV-era table;
- You’re a surgeon and need to operate on a patient (the concept of cleanliness comes into play, and it’s not the same kind of cleanliness as that of the average person);
- You are Vladimir Putin and want to put your conversation partner at ease.
In these three cases, you’re not looking for the same qualities, so you’ll expect to check different boxes on your favorite e-commerce site. A good table, when you’re the head of the Kremlin, is at least 6 meters long, whereas a surgeon will be more interested in the material (steel, carbon fiber), whether it’s height-adjustable, and whether it hinders the staff’s movements. It goes without saying, but you have a specific table model in mind based on the use you have in mind.
More generally, when you’re pursuing a goal, you implicitly construct a model of the world that serves that goal—and that goal itself: if you want to sail around the world, a map of ocean currents will be more useful to you than a map of religions or mineral deposits (on the other hand, a topographic map might help).
Moreover, it would make no sense to speak of “the” map of the world: no map can represent the entire world in all its dimensions. Reality is infinite, whereas the representation you create of it is necessarily finite.
So what exactly is a model, in computer science terms? A model is an abstraction—that is, a simplified representation of reality constructed for a specific operational purpose.
Traditionally, this is where we mention these two quotes:
- “The map is not the territory” – Alfred Korzybski
- “All models are wrong, but some are useful” – Georges Box
Alfred and Georges are actually saying the same thing: a model represents one facet of reality, not reality itself. First and foremost, a model therefore leaves out all facets of reality except one. As for that one facet, it too is represented imperfectly: it may be simplified, incomplete, or downright wrong. And yet, this model can still prove useful for achieving your goal: a map, drawn to the right scale, will help you even if it isn’t perfectly up to date.
When it comes to information systems, this means there is no single model, no “one-size-fits-all” model, and no canonical model. Any attempt to do so would amount to mixing different purposes. There is one model per context—the term “context” here referring to the concept of bounded context in Domain-Driven Design—because a context precisely reflects an operational purpose. The goal is to distinguish between models so that they can diverge, each specialized for a very specific use.
For example, your information system cannot provide a single representation of a Product, because the different departments within the company do completely different things with that product: one designs it, another manufactures it, a third stores it, yet another markets it, and perhaps a final one recycles it.
If there’s only one thing to remember, here it is:
1 contexte <=> 1 modèle
A model is therefore a projection of reality onto a use. But what, exactly, is reality? Can we truly access it, or do we only access its projections? This is, in essence, what Plato was already suggesting in the Allegory of the Cave: humans have their backs turned to the Sun and see only the shadows of the real world cast onto the back wall of the cave. For these humans, the shadows are the real world*.
* And the parallel ends here, for two reasons: 1. In DDD, there is no hierarchy; the models are sufficient for us, whereas Plato clearly states that shadows are worth less than full and complete reality; 2. But above all, Plato uses the allegory of the cave to illustrate the contrast between the sensible world and the intelligible world, the latter being defined precisely as the world of models, of pure forms. Drawing such a parallel may therefore be a misinterpretation.