skip to content

Core MDD Principles

The model, not the code, is the main artifact, with computation-independent, platform-independent and platform-specific layers separating concerns. You will learn what it takes for a model to serve as a single source of truth rather than documentation that drifts.

part ofSoftware design & architectureoverview, primer and where to startread it →
on this pageshow

questions

6

In Model-Driven Design, what does it mean to treat the model as the 'primary artifact' instead of treating diagrams as throwaway documentation?

level: juniorimportance: must knowfreq 70%

answer

  1. model = blueprint not poster
  2. translation gap
  3. ubiquitous language enforcement
  4. generated vs disciplined sync
  5. round-trip engineering

basics

~20 s

The model isn't a picture you draw once and forget — it's the actual blueprint that the code, database, and APIs are built from and kept in sync with, so it stays accurate and useful as the system evolves.

solid answer

~40 s

Treating the model as the primary artifact means the model — the set of concepts, relationships, and rules describing the domain or system — is the authoritative description everyone, including the code, must agree with, not a one-off diagram made for a kickoff meeting and never touched again. Documentation-only models drift from reality within weeks because nothing enforces alignment; a primary-artifact model instead drives implementation, either literally (code generation, executable models) or disciplinarily (the team refuses to let code diverge from the model's vocabulary and structure, as in Domain-Driven Design's ubiquitous language). The practical test: if you change the model, does something concrete have to change too, and if the code changes, does someone update the model? If the answer is no on either side, it's decoration, not a primary artifact.

go deeper

for a junior

Should be able to state that the model isn't a throwaway diagram and give one concrete example of code reflecting model vocabulary; doesn't need to know MDA or generation tooling.

for a middle

Should distinguish the generative (tool-driven) approach from the disciplinary (code-review-enforced) approach and know at least one has to be actively maintained.

for a senior

Should be able to name the translation-gap problem this solves, describe how their own team keeps code and model aligned in practice, and identify where it has slipped before.

for a principal

Should be able to weigh model-primacy discipline against delivery speed at an org level and design the process or tooling — review gates, codegen, or lightweight linting — that keeps a whole organization's models honest over years, not just one team's sprint.

## The artifact of record In most software projects, 'the model' shows up as a UML diagram in a wiki page, drawn during initial design and never opened again. **Model-Driven Design rejects that pattern.** It insists the model — a structured representation of the important concepts, their relationships, invariants, and behavior — is the artifact of record: the thing developers, testers, and business stakeholders treat as authoritative when they disagree about what the system does. Code, database schemas, and API contracts are expected to be derived from or kept faithful to the model, not the other way around. ## Two flavors Mechanically this plays out in two flavors. 1. **The heavyweight version is generative.** Tooling (in the OMG's Model Driven Architecture tradition, using UML plus the Meta Object Facility) reads a formal model and produces skeleton code, database DDL, or even a fully executable system, so the model is quite literally compiled. 2. **The lighter, more common version** — closer to Eric Evans' Domain-Driven Design usage of the term 'model-driven design' — **is disciplinary rather than mechanical.** There is no generator, but the team enforces that every class, method, and table name traces back to a concept in the model, and every model change forces a corresponding code change in the same commit. | Flavor | What keeps the code faithful | |---|---| | Generative, heavyweight | Tooling reads the formal model and produces the code | | Disciplinary, lighter | The team enforces that every name traces back to a concept in the model | Both flavors share the same goal: **eliminate the gap between what was designed and what was built.** ## The translation gap The problem this solves is an old one — the **translation gap**. A business analyst writes a spec, an architect draws a diagram interpreting the spec, and a developer writes code interpreting the diagram; at each hop, information is lost or silently reinterpreted, and six months later nobody can say with confidence what the system is actually supposed to do, because the diagram — if anyone still has it — no longer matches the code. Making the model the primary artifact collapses those hops: there's one representation that must stay true, and everything else answers to it. ## The trade-off: discipline versus speed The trade-off is discipline versus speed. Keeping a model authoritative costs continuous maintenance effort — every schema tweak, every new business rule, has to be reflected in the model as well as the code, and code reviews have to check for drift, not just correctness. Teams under deadline pressure routinely let this slip: - a developer patches the generated code directly to hit a deadline, or - adds a field to a table without updating the corresponding model element. In generative setups this is sharper still, because hand-edited generated code gets silently overwritten the next time someone regenerates from the model — the classic **round-trip engineering** failure mode; teams work around it with generator 'protected regions' or by abandoning generation for hand-written code that merely mirrors the model's vocabulary. ## What it cashes out to day-to-day A concrete real-world instance: shops using Domain-Driven Design tactically keep an aggregate concept — say, an `Order` with its `OrderLine` children — as the model, and insist that - the `Order` class in code, - the `orders` and `order_lines` tables, and - the API's `Order` DTO all use exactly that vocabulary and exactly that consistency boundary, with no helper classes carrying logic the model doesn't describe and no direct SQL updates to `order_lines` that bypass the `Order` aggregate's invariants. That discipline is what 'model as primary artifact' cashes out to day-to-day: not a diagram, but a standing rule that code must justify itself against the model, and the model must justify itself against the domain. ## How it fails Failure shows up gradually rather than as an outage: - new hires read the stale model and build features that contradict how the code actually behaves; - two teams implement the 'same' concept differently because each trusted a different stale copy of the model; - and eventually the model is quietly deleted from onboarding material because 'it's wrong anyway' — at which point the team has reverted to code-only design with all the translation-gap risk that model-driven design was meant to remove.

  • If a team has no code-generation tooling at all, can they still practice 'model as primary artifact'?
    Yes — this is the Domain-Driven Design flavor of model-driven design: there's no generator, but the team enforces by convention and code review that class names, method names, and structure trace directly back to the model's ubiquitous language. The discipline is social and process-based rather than tool-enforced, which is more fragile but far cheaper to adopt than a full generative toolchain.
  • What's the first sign a team has stopped treating the model as primary and started treating it as documentation?
    Code review comments stop referencing the model, and a change to business rules gets implemented in code without anyone updating the model artifact in the same change. Once that happens once without pushback, the model starts drifting and rarely recovers without a deliberate re-sync effort.

It's the difference between an architect's blueprint that the construction crew is legally required to follow, and that gets updated the moment a wall moves, versus a lobby poster showing an 'artist's impression' of the building that nobody checks against the actual construction.

saying these in an interview costs you the question

  • calls the model 'just a diagram we made at the start'
  • can't explain what forces the model and code to stay in sync
  • conflates having a UML diagram with practicing model-driven design
  • no answer for what happens when code and model disagree

context

open as a page

What do the CIM, PIM, and PSM layers represent in the Model Driven Architecture (MDA) approach to Model-Driven Design, and how does a change flow between them?

level: middleimportance: must knowfreq 55%

basics

~20 s

They're three levels of the same design, from business-language description (CIM), to a tech-neutral system design (PIM), to a version tied to one specific technology (PSM) — each layer adds detail the previous one deliberately left out.

open as a page

Model-Driven Design treats the model as the 'single source of truth' for a system. What actually happens in production teams when the code and the model start to drift apart, and how do teams recover from it?

level: seniorimportance: must knowfreq 60%

basics

~20 s

When developers change code without updating the model, or vice versa, the model stops being trustworthy — new features get built on wrong assumptions, and fixing it usually means a deliberate re-sync project rather than something that happens automatically.

open as a page

In a layered Model-Driven Design approach, such as platform-independent versus platform-specific models, what does it mean for an abstraction layer to 'leak,' and why does that undermine the whole approach?

level: middleimportance: should knowfreq 45%

basics

~20 s

Leaking means details from a lower, more technical layer sneak into a higher, supposedly technology-neutral layer, like a database-specific trick showing up in the 'business' model, which defeats the whole point of keeping them separate.

open as a page

Given that treating the model as a governing, single-source-of-truth artifact sounds appealing, when would you deliberately choose NOT to adopt heavyweight Model-Driven Design — formal CIM/PIM/PSM layers plus generative tooling — for a project?

level: principalimportance: should knowfreq 35%

basics

~20 s

When the project is small, the platform won't change, or the domain is still being figured out — the cost of building and maintaining formal layered models and generators outweighs any benefit, and a lighter, code-first approach ships faster and adapts better.

open as a page

The term 'Model-Driven Design' is used both by the OMG's Model Driven Architecture community and by Eric Evans' Domain-Driven Design. What's the key difference between what each means by it, and why does the confusion matter in practice?

level: seniorimportance: nice to knowfreq 20%

basics

~10 s

OMG's version means machines transform formal models into code automatically; Evans' Domain-Driven Design version means developers hand-write code that mirrors an evolving domain model — same name, very different amount of automation and formality.

open as a page