Domain Service

A domain service is a domain model operation that belongs to no single entity or value object, such as removing dominated strategies and computing ICERs.

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

Domain Service in Domain-Driven Design

In Domain-Driven Design (DDD), a domain service is the way a domain model records an important operation of the subject area when that operation has no natural home on any single object. For health economists a likely candidate is the incremental analysis that compares every strategy in a cost-effectiveness model, because the comparison belongs to the set of strategies and to none of them alone. Writing such an operation as a named service with a stated contract keeps one rule, for example that each ICER is calculated against the next non-dominated strategy, in one place where reviewers can find and test it. The idea concerns how the software behind a health economic model is organised and says nothing about which strategy offers value for money.

Where the term comes from and who uses it

The term has its origin in software design and is new to health economics. Three sources set out its meaning.

  • Eric Evans made services one of the building blocks of a model in his 2003 book on Domain-Driven Design. Its contents place a section on services after entities and value objects, with subsections on services and the isolated domain layer, granularity and access, and its index lists the partitioning of services into layers. His free 2015 reference summarises the pattern under the heading Services.
  • Martin Fowler, writing in 2003 about anemic domain models, quotes Evans's account of a thin application layer that holds no business rules.
  • Microsoft's architecture guidance on tactical DDD, last updated in February 2026, separates domain services, which hold business rules spanning several entities or aggregates, from application services, which coordinate use cases. The wiki label follows this usage.

None of the health economics guidance or checklists cited below uses the term. The Model Execution examples are the wiki's own application of DDD, drawn up for its Domain Layer and not yet tested with practitioners.

What makes an operation a domain service

Evans's reference starts from the observation that some domain concepts are not natural to model as objects. Forcing such an operation onto an entity or a value object, he writes, either distorts that object or adds meaningless artificial objects. When a significant process or transformation in the domain is not a natural responsibility of an entity or value object, the model gains an operation declared as a standalone interface, called a service.

The pattern attaches three requirements to every service. The service has a contract, which Evans defines as a set of assertions about interactions with the service. The assertions are stated in the ubiquitous language of one specific bounded context. The service also has a name that becomes part of that language, so the team speaks of the service as well as coding it.

Neighbouring patterns in the reference shape how a good service looks. Evans asks designers to state the post-conditions of operations, to name operations for their effect and purpose without reference to how they achieve it, and to place as much logic as possible in operations that return results with no observable side effects. The Microsoft guidance adds that a service in DDD is a stateless object.

Domain services and application services

Evans's layered architecture pattern isolates all code related to the domain model from the user interface, the application and the infrastructure. Services can appear in more than one layer, so the qualifier domain marks which kind is meant. In the passage Fowler quotes, Evans's application layer defines the jobs the software is supposed to do and directs the domain objects to work out problems, while holding no business rules or knowledge. Microsoft likewise describes application services as orchestrating use cases and containing no business logic themselves.

A candidate Model Execution context shows the split. Running the approved base case with parameter set V3 is an application task, because it loads the inputs, starts a model run and stores the outputs. Writing those outputs to a file is infrastructure work. The rule for comparing the strategies' totals is domain knowledge, held by a domain service.

A domain service for incremental analysis

The NICE manual for technology appraisal (PMG36, section 4.10.8) states that economic evaluation results should be presented in a fully incremental analysis, with dominated technologies removed, meaning those more costly and less effective than another technology in the analysis. Technologies subject to extended dominance, where a combination of two or more other technologies would be more cost effective, are removed too. The procedure needs the totals of every strategy at once, and no single strategy can decide whether it is dominated, which is the situation Evans's pattern describes.

In the candidate context the operation might be called Calculate Incremental Results. The table gives an illustrative contract written as assertions.

AssertionKindOrigin of the rule
All strategy totals are expected values from one analysis, either one deterministic run or the means over all runs of one probabilistic analysis, in one currency and price yearPre-conditionThe wiki's own candidate rule
Dominated and extendedly dominated strategies are removedPost-conditionNICE PMG36, section 4.10.8
Each ICER is calculated against the next non-dominated strategyPost-conditionTECH-VER checklist
The reported ICERs are non-decreasing in order of costPost-conditionTECH-VER checklist

The TECH-VER verification checklist of Büyükkaramikli and colleagues asks whether the reported ICERs in the fully incremental analysis are non-decreasing. The paper also describes a student model that calculated an ICER against the cheaper technology instead of the previous cost-effective one, an error such a black-box test could have detected. A service whose contract states this post-condition makes the test part of the design, checked at run time or by automated tests, as Evans's assertions pattern allows. Without using DDD terms, the cohort state-transition tutorial of Alarid-Escudero and colleagues already passes the total costs and QALYs of four strategies to the calculate_icers function of the dampack package, which returns the ICERs between non-dominated strategies.

Worked example with five strategies

All numbers in this example are illustrative. The ratio between neighbouring strategies that remain in the analysis is calculated as follows.

ICERk=Ck−Ck−1Ek−Ek−1\text{ICER}_k = \frac{C_k - C_{k-1}}{E_k - E_{k-1}}

where ICERk\text{ICER}_k is the incremental cost-effectiveness ratio of strategy kk, CkC_k is its total expected cost in GBP, EkE_k is its total expected QALYs, and k−1k-1 is the next less costly strategy still in the analysis, with strategies ordered by increasing cost.

StrategyTotal cost (GBP)Total QALYs
Standard care10,0005.00
Strategy A13,0005.10
Strategy B15,0005.40
Strategy C16,0005.10
Strategy D22,0005.50
  1. Remove dominated strategies. Strategy C costs GBP 16,000 for 5.10 QALYs, while Strategy B costs less and gives 5.40 QALYs, so Strategy C is dominated.
  2. Calculate ICERs in order of cost. Strategy A against standard care gives 3,000 divided by 0.10, which is GBP 30,000 per QALY. Strategy B against Strategy A gives 2,000 divided by 0.30, about GBP 6,667 per QALY. Strategy D against Strategy B gives 7,000 divided by 0.10, which is GBP 70,000 per QALY.
  3. Remove extended dominance. The ICER falls from GBP 30,000 to about GBP 6,667 per QALY, so Strategy A is extendedly dominated.
  4. Recalculate. Strategy B against standard care gives 5,000 divided by 0.40, which is GBP 12,500 per QALY, and Strategy D against Strategy B stays at GBP 70,000 per QALY.

The final sequence of GBP 12,500 and then GBP 70,000 per QALY is non-decreasing, so the post-condition holds and the service returns standard care, Strategy B and Strategy D. An implementation that skipped step 3 would report GBP 30,000, about GBP 6,667 and GBP 70,000 per QALY, and a run-time check of the contract would reject that output before any cost-effectiveness frontier or report used it. Comparing the ICERs with a threshold is a separate decision step outside this service. In a probabilistic analysis the service works on the mean costs and QALYs over all runs, because NICE PMG36 prefers the committee's estimate to come from a probabilistic analysis when possible (section 4.7.12) and requires each ICER to be the ratio of expected additional cost to expected additional QALYs (section 4.2.16). An average of ICERs taken from single runs would not meet that rule.

Choosing where a calculation belongs

Evans treats a service as the home for behaviour with no natural owner and does not make it the default place for calculations. His side-effect-free functions pattern suggests moving complex logic into value objects when a concept fitting the responsibility presents itself. Discounting a cost stream that carries its own currency, price year and timing could therefore sit on a value object, and incremental analysis could be a method of a result set that already holds every strategy from one analysis. The domain model records the choice so that everyone reads the same answer.

The curators' Domain Layer plans versioned mathematical component pages for a three-state Markov model, covering transition-matrix validation, cohort propagation, reward accumulation and discounting. These pages are planned and not yet live, and the briefing treats each one as a behaviour of a domain model. Whether that behaviour is a domain service, a method of the Model Run aggregate or an operation on a value object is decided in the domain model.

Boundaries with nearby ideas

A domain service is a concept inside one domain model and is distinct from a microservice. The curators' briefing uses microservice for a small piece of software that does one job and that other software calls by name, and the Microsoft guidance warns that the DDD sense of service does not directly relate to microservices.

An open host service, a separate page in this group, works at the scale of whole bounded contexts. Evans describes it as a protocol giving access to a subsystem as a set of services for every context that needs to integrate with it, so it belongs on a context map and not inside one domain model. A domain event, also in this group, records that something happened in the domain, while a domain service performs an operation. The model function of the DARTH coding framework, which maps model inputs to outputs, is closer to the execution of a whole model run than to one domain operation.

Common misreadings

Three misreadings are likely in health economic work. Each one puts logic in the wrong layer or under the wrong name.

  1. Moving every calculation into services. Fowler describes the anemic domain model, whose objects carry the names of domain things but hardly any behaviour, while services hold all the logic. In his view, the more behaviour sits in services, the more likely the design is to lose the benefits of a domain model.
  2. Letting business rules into the application layer. A script that runs the base case and also decides which strategies are dominated mixes coordination with domain knowledge. Evans's application layer holds no business rules, so the dominance rule belongs in the domain layer.
  3. Treating any function as a domain service. A helper that formats a results table or writes a file is infrastructure or presentation code. A domain service performs a significant process of the domain, has a contract and carries a name the domain experts recognise.

Sources

Library

Publications

4
  • Other

    AnemicDomainModel — Fowler M, 2003 (martinfowler.com bliki)

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

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

  • Other

    Use tactical DDD to design microservices — Microsoft, 2026 (Microsoft)

    Source listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Domain Service, 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 Domain Service?

    A domain service is a domain model operation that belongs to no single entity or value object, such as removing dominated strategies and computing ICERs.

    Source: Evans 2015

  • Where does the term Domain Service come from?

    Domain Service is a term from software design and is new to health economics. Eric Evans made services one of the building blocks of a domain model in his 2003 book on Domain-Driven Design, and his free reference of 2015 summarises the pattern under the plain heading Services. The qualifier domain follows Microsoft's architecture guidance on tactical Domain-Driven Design, which separates domain services holding business rules from application services that coordinate tasks. None of the health economics guidance or checklists the wiki cites on this page uses the term, so its health economics examples are the wiki's own.

    Source: Evans 2015

  • When should an operation be modelled as a Domain Service?

    Evans's 2015 reference adds an operation to the model as a service, the pattern behind a Domain Service, when a significant process or transformation in the domain is not a natural responsibility of an entity or a value object. Forcing such an operation onto one object, he writes, either distorts that object or adds meaningless artificial objects. The service is declared as a standalone interface with a contract, which Evans defines as a set of assertions about interactions with the service, stated in the ubiquitous language of one bounded context. Its name also becomes part of that language, so the team speaks of the service as well as coding it.

    Source: Evans 2015

  • How does a Domain Service differ from an application service?

    Microsoft's architecture guidance on tactical Domain-Driven Design describes a Domain Service as encapsulating business rules that span several entities or aggregates. Application services orchestrate use cases and contain no business logic themselves, and the same guidance treats a service in this sense as a stateless object. In the wiki's illustration of a Model Execution context, running the approved base case with a given parameter set is an application task, because it loads the inputs, starts a model run and stores the outputs. The rule for comparing the strategies' totals is domain knowledge and belongs in a domain service.

    Source: Microsoft 2026

  • How could a Domain Service handle incremental analysis in a health economic model?

    In the wiki's illustration, a Domain Service called Calculate Incremental Results takes the expected costs and QALYs of every strategy from one analysis, a deterministic run or the means of a probabilistic one, since no strategy alone can decide whether it is dominated. Its contract removes dominated and extendedly dominated strategies and calculates each ICER against the next non-dominated strategy. Another post-condition requires the reported ICERs to be non-decreasing in order of cost, a check the TECH-VER checklist asks for. The paper describes a student model that calculated an ICER against the cheaper technology instead of the previous cost-effective one. A contract stating this post-condition makes that test part of the design, checked at run time or by automated tests.

    Source: Büyükkaramikli et al. 2019

  • What are common mistakes when using a Domain Service in health economic modelling?

    One mistake is to move every calculation into a Domain Service, leaving objects that carry the names of domain things but hardly any behaviour. Fowler calls this the anemic domain model and argues that the more behaviour sits in services, the more likely the design is to lose the benefits of a domain model. Another is to let a script that runs the base case also decide which strategies are dominated, because the application layer Evans describes, as Fowler quotes it, holds no business rules. A helper that formats a results table or writes a file is also presentation or infrastructure code and does not qualify.

    Source: Fowler 2003

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

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/domain-service