8. Canonical models and integration
When every system translates directly to every other, the number of translations grows with the square of the number of systems. A canonical model is a shared language in the middle: each system translates once, to it and from it.
The clip counts mappings as systems are added. With point-to-point integration every system needs a translation to every other: n times n minus one. With a canonical model each system needs one translation to the model and one from it: two times n. The two are equal at three systems; at six systems, Harbour Mutual's claims estate, it is thirty against twelve, and the gap keeps growing. It ends with what a canonical model must have: an owner, versions and a small scope.
The intuition: a common language at a table of many languages
Imagine a meeting of six people, each speaking a different language, with an interpreter for every pair. That is fifteen pairs, and thirty directions of translation. Add a seventh person and you need twelve more. Now agree that everyone speaks to one shared language and back: six people need twelve translations, and the seventh adds only two.
Harbour Mutual's systems are those six people. The policy system, the claims system, the CRM, billing, the portal and the warehouse each describe a policy in their own way. Today each pair that exchanges data has its own mapping, written by whoever built the interface. When the policy system adds a field, every mapping that reads it must change.
A canonical model is the shared language: one agreed description of a policy, a claim and a customer for the messages that travel between systems. Each system maps once to it and once from it. A change in one system is absorbed by that system's two mappings, and the others never notice.
The theory: the pattern, its design rules and its limits
Gregor Hohpe and Bobby Woolf catalogued the canonical data model as an enterprise integration pattern in 2003: design a data model independent of any one application, and have each application produce and consume messages in it. A message translator converts between an application's format and the canonical one, and a normalizer routes incoming messages in many formats through the right translator.
The arithmetic is simple. With n systems all exchanging the same kind of data directly, there are n × (n − 1) one-way mappings. Through a canonical model there are 2 × n. They are equal when n is 3; from four systems on, the canonical model needs fewer, and the gap grows with the square of n. In practice not every pair talks, so the real saving is smaller, but the real benefit is different: a change stays local.
Design rules. Model business things and business events (a claim was reported), not one system's screens. Use the business's terms from the glossary and its managed codes from reference data, so the canonical message says escape-of-water, not each system's local code. Include only what more than one consumer needs; let each system keep its private detail. Give every message an envelope: who sent it, when, which version of the model it follows. Give the model an owner who decides changes, and versions: adding an optional field is a minor version that existing consumers ignore; removing or renaming a field is a major version that runs beside the old one until every consumer has moved.
The limits. A canonical model for the whole enterprise tends to grow into a giant compromise that fits nobody: every team adds its fields, nothing is ever removed, and changes queue behind one central team. Domain-driven design, described by Eric Evans in 2003, offers a different answer: each bounded context (claims, billing, sales) keeps its own model and its own meaning of a word, and a context map records how the contexts relate; an anti-corruption layer translates at each boundary so one context's model does not leak into another. Many organisations land in between: one canonical model per domain, published by the domain that owns the data. That is close to the data products and contracts of page 17.
Industry bodies publish canonical models too. In insurance, ACORD's standards describe policies, claims and parties for exchange between insurers, brokers and partners. Adopting an industry model saves design work and makes partners easier to connect, at the cost of carrying fields and terms the organisation does not use.
Why it matters
The merger doubles the number of systems. Without a canonical model, connecting Kestrel's systems to Harbour Mutual's means writing mappings between every pair that must talk, each one encoding a local guess about what the other side means. With one, each Kestrel system maps to the model once, and the meaning is decided once, by the model's owner.
The canonical model is also where the glossary and reference data become real: if the model says a claim's cause is a code from the managed loss-cause list, every system that sends claims must map to that list.
Where it goes wrong
- The god model. An enterprise-wide canonical model with every field anyone ever wanted is too big to understand and too risky to change.
- One system's model, renamed. Promoting the biggest system's format to "canonical" keeps its quirks and calls them standards.
- No owner, no versions. Changes made by whoever needs them break consumers without warning.
- Local codes inside. A canonical message that carries each sender's own codes has only moved the translation to every receiver.
- Mapping without meaning. Two fields with the same name are mapped although they mean different things; the canonical model must define meaning, not only shape.
Check yourself
Choose an answer to each question, then press Check.
Sources
The works this page draws on, summarised in its own words rather than quoted. Read them for the full argument.
- G. Hohpe and B. Woolf, Enterprise Integration Patterns (Addison-Wesley, 2003)The canonical data model, message translator and normalizer patterns, and the arithmetic of point-to-point integration.
- E. Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software (Addison-Wesley, 2003)Bounded contexts, context maps and the anti-corruption layer.
- ACORD, the insurance industry's data standardsAn industry canonical model for exchanging policy, claim and party data.
Practise it
The chapters that put this theory to work on Harbour Mutual and Kestrel:
- Chapter 8: Canonical models for integration
- Chapter 29: Integration patterns: batch, streaming, APIs and sharing
- Chapter 39: Stage 2: Common meaning
The tools to try it in:
- Information map · The enterprise information map: capabilities, domains, systems, flows and platforms, each layer switched on or off.
- Model studio · Draw conceptual, logical and physical models, generate DDL for PostgreSQL, Spark SQL and T-SQL, and run it on Harbour Mutual's data in your browser.
Terms taught here: Canonical data model