Anticorruption Layer

An anticorruption layer in Domain-Driven Design translates another system's data into a context's own terms, such as legacy workbook inputs for a model.

Status
Published, version 1.0.1
Last reviewed
17 Nov 2026, by Dr Darrin Baines
Report a problem
Tell us if something is wrong or out of date

Concept Architecture

Anticorruption Layer in Health Economic Modelling

In Domain-Driven Design (DDD), an anticorruption layer is a piece of software that a downstream context builds at its own boundary so that data and services from an awkward upstream system arrive already restated in the downstream model's terms. The word corruption refers to a model being bent out of shape by another system's concepts, and it has nothing to do with fraud or with corruption in health systems. Health economic work has many such hand-overs, since models take inputs from workbooks, statistical packages and hospital records built for other purposes. In the wiki's Domain Layer the pattern is a candidate wherever a Model Execution context or a costing context would have to translate what it receives before its own rules can be checked.

Origin of the term and who uses it

Anticorruption Layer is a software design term and is new to health economics. Eric Evans introduced it in his 2003 book Domain-Driven Design, where the contents list places it in the chapter on maintaining model integrity, with sections on designing and implementing its interface, and the index lists facades and adapters under it. His free reference booklet of 2015 files it under context mapping for strategic design, between conformist and open-host service, and his 2013 paper on starting DDD among legacy systems builds its strategies around it.

Vaughn Vernon's Domain-Driven Design Distilled (2016) lists it among the types of context mapping, and Microsoft's Azure architecture guidance describes an Anti-Corruption Layer pattern, spelled with a hyphen, crediting Evans with its first description. The wiki label follows Evans's spelling. None of the health economics sources read for this page uses the term.

The problem the pattern addresses

Evans starts from translation between bounded contexts. Translation layers can be simple when they join well designed contexts run by cooperative teams. When control or communication is not good enough for a shared kernel, a partnership or a customer and supplier relationship, translation becomes harder and takes on a defensive tone. A large interface with an upstream system can eventually overwhelm the intent of the downstream model, which is then modified to resemble the other system's model in an ad hoc way. The models of legacy systems are usually weak, conforming to them is often impractical, and yet the integration may be valuable or even required.

His remedy is that the downstream client creates an isolating layer that provides its system with the functionality of the upstream system in terms of its own domain model. The layer talks to the other system through that system's existing interface, which needs little or no modification, and internally it translates in one or both directions between the two models. On a context map the layer therefore always belongs to the downstream side. Evans notes that clients of an open-host service are downstream and that typically some of them conform while others build anticorruption layers.

How the layer is built and what it costs

Evans's 2013 paper adds design advice from practice. He writes that ideally the translator should just translate, and gives two failures. In the first, legacy fields are mapped to new concepts whose meaning differs, so the calculated figure is still correct but the design is brittle and hampers communication. In the second, a difference is computed inside the translator, which moves business logic out of the domain model where it belongs.

He also warns that an anticorruption layer is a significant piece of software in its own right, to be budgeted, planned and kept decoupled from the business logic of the new system, and that refactoring model elements fed from the legacy side means changing the layer too. The paper describes two architectures. A layer behind a repository has no data of its own and fetches and translates on demand, while a synchronising layer keeps a separate store up to date against an agreed service level, and Evans counts the humble nightly batch script as a familiar low-tech example. Whatever the mechanism, any information crossing a context boundary must be translated, because messages are always expressed in the language of some model.

Microsoft adds that the layer brings latency and an extra service to maintain, and that the pattern may not suit systems with no significant semantic differences, in which case the layer should focus on translation without business rules or orchestration.

Where translation happens in health economic work

The health economics sources consulted here do not name such layers, yet the verification literature records errors at these hand-overs. The TECH-VER checklist of Büyükkaramikli and colleagues gives a first verification stage to pre-analysis calculations that yield cycle-based or event-based model inputs from reference sources, often performed outside the model in other statistical software. Among its real examples are the wrong translation of log-transformed regression outputs into the distribution function used for survival extrapolation in a student course model, and a company submission that converted an annual resource use estimate into a weekly probability instead of dividing it by 52. TECH-VER does not use DDD terms, so reading these as errors at a boundary between contexts is the wiki's interpretation. On the wiki's reading of Evans's rule, the step from an annual to a weekly figure depends on the cycle length, so it is model logic that belongs inside the model rather than in a translator.

The following candidate settings are the wiki's illustration and are untested in practice.

  1. Model Execution reading a legacy workbook. An older spreadsheet supplies transition probabilities with its own state labels and column order, and the layer restates them as a parameter set in the model's terms.
  2. Model Execution reading survival output. A parametric survival model fitted in a statistics package reports coefficients and their covariance matrix in that package's parameterisation, and the layer converts both to the form the model expects.
  3. Costing reading hospital activity records. Activity records grouped for payment, such as by healthcare resource group, are restated as resource use items that the costing context then values with its own unit costs.

Evans's rule also says where some health economic steps belong. A rate-to-probability conversion depends on the model's cycle length and on an assumption about the rate, so on the wiki's reading it is model logic that sits inside Model Execution, while relabelling, reordering and changing percentages to proportions are translation that sits in the layer.

Worked example with a legacy transition table

The following example is illustrative. A Model Execution context runs a three-state Markov cohort model with states in the order Healthy (H), Sick (S) and Dead (D). A legacy workbook holds the same annual transitions, but its states are labelled Well, Ill and Dead, its columns run Dead, Ill, Well, and its entries are percentages. The Well row reads 1, 14 and 85, the Ill row reads 5, 75 and 20, and the Dead row reads 100, 0 and 0.

The anticorruption layer maps each label to a state of the model, places each value by label rather than by position and divides by 100. The resulting transition matrix, read by rows, is as follows.

P=(0.850.140.010.200.750.05001)P = \begin{pmatrix} 0.85 & 0.14 & 0.01 \\ 0.20 & 0.75 & 0.05 \\ 0 & 0 & 1 \end{pmatrix}

where PP is the transition matrix, the rows and columns run H, S and D in that order, and each entry is the probability that a person in the row state is in the column state one annual cycle later. Each row sums to 1, since 0.85 + 0.14 + 0.01, 0.20 + 0.75 + 0.05 and 0 + 0 + 1 all equal 1. The curators' briefing plans a Rules and Invariants record stating that each row sums to 1 within 0.000001, and this matrix meets it. The cohort then moves as in the tutorial by Alarid-Escudero and colleagues.

mt+1=mtPm_{t+1} = m_t P

where mtm_t is the row vector of the number of people in H, S and D at cycle tt, and PP is the transition matrix above. Starting from m0=(1000,0,0)m_0 = (1000, 0, 0), cycle 1 gives H =1000×0.85=850= 1000 \times 0.85 = 850, S =1000×0.14=140= 1000 \times 0.14 = 140 and D =1000×0.01=10= 1000 \times 0.01 = 10. Cycle 2 gives H =850×0.85+140×0.20=750.5= 850 \times 0.85 + 140 \times 0.20 = 750.5, S =850×0.14+140×0.75=224= 850 \times 0.14 + 140 \times 0.75 = 224 and D =850×0.01+140×0.05+10=25.5= 850 \times 0.01 + 140 \times 0.05 + 10 = 25.5, a total of 1,000.

Now suppose a careless translator copies the columns by position. The H row becomes 0.01, 0.14 and 0.85, the S row becomes 0.05, 0.75 and 0.20, and the D row becomes 1, 0 and 0. Every row still sums to 1 and every entry lies between 0 and 1, so the row-sum rule passes. Cycle 1 then gives H =1000×0.01=10= 1000 \times 0.01 = 10, S =140= 140 and D =1000×0.85=850= 1000 \times 0.85 = 850. Cycle 2 gives H =10×0.01+140×0.05+850×1=857.1= 10 \times 0.01 + 140 \times 0.05 + 850 \times 1 = 857.1, S =10×0.14+140×0.75=106.4= 10 \times 0.14 + 140 \times 0.75 = 106.4 and D =10×0.85+140×0.20=36.5= 10 \times 0.85 + 140 \times 0.20 = 36.5, again a total of 1,000.

The faulty model kills 850 of 1,000 people in the first year and then returns most of them to health. A TECH-VER check comparing the number in the dead or any absorbing state with earlier periods, expecting it to be larger, would catch the fall at cycle 2, and a test inside the layer confirming that Dead keeps everyone it holds would catch it before any run. The invariant protects the Model Execution model, while tests in the layer protect the meaning of what crosses the boundary.

How the pattern differs from nearby ideas

An anticorruption layer is one of several relationships a context map can record. A conformist downstream context simply adopts the upstream model, a shared kernel shares a small, explicitly bounded part of the model between teams, and a published language puts a documented common language between contexts, with each translating into and out of it. Evans presents the layer as the defensive choice when a shared kernel, a partnership or a customer and supplier relationship cannot be achieved and conforming is impractical.

A mapping function in health economics is a fitted equation that predicts utility from other outcome scores, an estimated model with its own uncertainty, whereas an anticorruption layer restates the same information in another model's terms without estimating anything. Input data validation checks values against rules, and the layer can call such checks at the boundary, but checking values is a separate task from translating them. An anticorruption layer is also private to one downstream context and does not create the shared formats that digital interoperability needs.

Limitations and common misreadings

DDD is software design practice, and no source read for this page evaluates anticorruption layers in health economic modelling. Four misreadings are likely when the idea is carried across.

  1. Treating the layer as a free adapter. Evans calls it a significant piece of software to be budgeted and planned, so where the upstream model can be adopted as it stands, conforming to it may be the cheaper choice, and Evans notes that conformity enormously simplifies integration.
  2. Putting model logic in the translator. Conversions that depend on modelling assumptions, such as cycle length, belong in the model where reviewers expect to find them.
  3. Boring tunnels through the layer. Evans warns that passing legacy fields through unchanged, or bypassing the layer under deadline pressure, erodes the boundary until the new model conforms to the old one.
  4. Assuming translation checks the source. An error in a network meta-analysis or a costing workbook passes through the layer unchanged, so technical verification of the inputs is still needed.

Sources

Library

Publications

5
  • Other

    Domain-Driven Design Reference: Definitions and Pattern Summaries — Evans E, 2015 (Domain Language)

    Source listed in the Sources of the HealthEconomics.wiki Concept Architecture articles on Domain-Driven Design, Domain (Domain-Driven Design), Subdomain (Domain-Driven Design), Core Domain, Bounded Context, Ubiquitous Language, Domain Model, Context Map, Strategic Design, Domain Expert, Entity (Domain-Driven Design), Value Object, Aggregate (Domain-Driven Design), Invariant (Domain-Driven Design), Anticorruption Layer, Published Language, Domain Event, Domain Service, Shared Kernel and Open Host Service, where it is cited as a reference for these concepts.

  • Book

    Domain-Driven Design Distilled — Vernon V, 2016 (Addison-Wesley)

    Book or book chapter listed in the Sources of the HealthEconomics.wiki Concept Architecture articles on Subdomain (Domain-Driven Design), Core Domain, Bounded Context, Context Map, Strategic Design, Domain Expert, Shared Kernel, Open Host Service, Ubiquitous Language and Anticorruption Layer, where it is cited as a reference for these concepts.

  • Other

    Getting Started with DDD When Surrounded by Legacy Systems — Evans E, 2013 (Domain Language)

    Source listed in the Sources of the HealthEconomics.wiki Concept Architecture articles on Core Domain and Anticorruption Layer, where it is cited as a reference for these concepts.

  • Other

    Anti-Corruption Layer pattern — Microsoft, 2026 (Microsoft)

    Source listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Anticorruption Layer, where it is cited as a reference for that concept.

  • Book

    Domain-Driven Design: Tackling Complexity in the Heart of Software — Evans E, 2003 (Addison-Wesley)

    Book or book chapter listed in the Sources of the HealthEconomics.wiki Concept Architecture articles on Domain-Driven Design, Domain (Domain-Driven Design), Core Domain, Bounded Context, Context Map, Published Language, Open Host Service, Ubiquitous Language, Domain Model, Strategic Design, Domain Expert, Entity (Domain-Driven Design), Invariant (Domain-Driven Design), Anticorruption Layer, Shared Kernel, Value Object and Domain Service, where it is cited as a reference for these concepts.

Frequently Asked Questions (6)

  • What is Anticorruption Layer?

    An anticorruption layer in Domain-Driven Design translates another system's data into a context's own terms, such as legacy workbook inputs for a model.

    Source: Evans 2015

  • Where does the term Anticorruption Layer come from?

    Anticorruption Layer is a term from software design and is new to health economics. Eric Evans named it in Domain-Driven Design, and his free reference booklet of 2015 files it under context mapping for strategic design, beside patterns such as conformist and open-host service. In the name, corruption means a model being bent out of shape by the concepts of another system, not fraud or corruption in health systems. The layer sits on the downstream side of a relationship between two bounded contexts and protects that side's own model.

    Source: Evans 2015

  • When should a team build an Anticorruption Layer?

    Eric Evans recommends an Anticorruption Layer when a downstream team needs an upstream system but control or communication is not good enough for a shared kernel, a partnership or a customer and supplier relationship. Legacy models are usually weak, so conforming to them is often impractical, yet the integration may be valuable or even required. The downstream client then builds an isolating layer that talks to the other system through its existing interface and translates between the two models. For a health economic model fed by an old spreadsheet, the layer would restate the workbook's labels and formats in the model's own terms.

    Source: Evans 2015

  • What should an Anticorruption Layer translate, and what should it leave to the model?

    Eric Evans writes that ideally the translator in an Anticorruption Layer should just translate. In his example, computing a credit limit minus a balance inside the translator moves business logic out of the model where it belongs. In health economic terms, relabelling health states, reordering columns and turning percentages into proportions are translation. A rate-to-probability conversion depends on the cycle length and on an assumption about the rate, so on the wiki's reading it belongs inside the model, where reviewers expect to find it.

    Source: Evans 2013

  • Why can an Anticorruption Layer error pass a transition matrix row-sum check?

    A transition matrix in a cohort model must have entries between 0 and 1 and rows that sum to one, as the tutorial by Alarid-Escudero and colleagues states. If an Anticorruption Layer copies a legacy table by column position instead of by state label, every row can still sum to one while probabilities land in the wrong cells. In an illustrative three-state model, such an error sent 850 of 1,000 healthy people to death in the first cycle and then returned most of the dead to health. The layer therefore needs its own tests that check each value is placed by label.

    Source: Alarid-Escudero et al. 2023

  • What are common mistakes when using an Anticorruption Layer in health economic modelling?

    One mistake is to treat an Anticorruption Layer as a free adapter, although Eric Evans calls it a significant piece of software that should be budgeted and planned. Another is passing legacy fields through unchanged, which Evans describes as boring a tunnel through the layer, so that the new model slowly conforms to the old one. Teams also sometimes assume the layer checks the quality of what it receives, but it only restates upstream data, so errors in a source workbook or analysis pass through it and still need technical verification.

    Source: Evans 2013

Trust Record

Verified by Dr Darrin Baines

British health economist

Professional identity: darrinbaines.org

Verification date: 17 Nov 2026

Content version: 1.0.1

Canonical Identity

Term code
HS-HP-DH-124

Stable URI · Machine-readable · Resolvable · CC BY 4.0

This article is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).

Author: Dr Darrin Baines · Publisher: Intelligent Parameters Ltd · Identifier: https://healtheconomics.wiki/concept/anticorruption-layer