skip to content

Domain-Driven Design & Application Patterns

Modeling software around the business domain and organizing the application layer around that model. This area covers DDD's strategic and tactical halves, model-driven design, and Fowler's enterprise application patterns.

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

explore

questions

174 · 4 sections

In Domain-Driven Design, what is a bounded context, and why might the word 'Order' mean something different inside a company's Sales system than inside its Shipping system?

level: juniorimportance: must knowfreq 75%
basics
~10 s

A bounded context is a boundary around a part of a system where a specific model and its terms have one exact meaning. Outside that boundary, the same word can mean something completely different.

open as a page

In Domain-Driven Design, what is a context map, and what three things does it typically show about a system made up of multiple bounded contexts?

level: juniorimportance: must knowfreq 70%
basics
~10 s

A context map is a diagram showing all the bounded contexts in a system, how they connect, which one leads (upstream) vs follows (downstream), and which teams own each one.

open as a page

In Domain-Driven Design, what is an Anti-Corruption Layer (ACL), and why would a team put one between their bounded context and an external or legacy system?

level: juniorimportance: must knowfreq 70%
basics
~10 s

An Anti-Corruption Layer is a translation wall between your code and someone else's system, so their messy or different data model doesn't leak into and pollute your own model.

open as a page

In Domain-Driven Design, what is a Domain Vision Statement and why do teams write one when distilling the core domain?

level: juniorimportance: must knowfreq 65%
basics
~10 s

A domain vision statement is a short written description of the core domain, its value, and why it will make the product win — a compass for what's most important to build well.

open as a page

A team runs a workshop where people write things on orange sticky notes in past tense (like 'Order Placed' or 'Payment Failed') and stick them on a long roll of paper in a rough timeline, with all the chairs removed from the room. What is this workshop technique called and what is its core mechanism?

level: juniorimportance: must knowfreq 55%
basics
~20 s

This is Event Storming - a workshop where people from business and tech stand at a wall and write domain events (things that happened) on orange sticky notes in time order, to quickly build a shared picture of how a system or business process really works.

open as a page

In Domain-Driven Design, what is an aggregate root, and why should code outside the aggregate hold a reference to it by ID rather than by object pointer?

level: juniorimportance: must knowfreq 80%
basics
~20 s

An aggregate root is the single object outside code may touch inside a related cluster. Everything else is reached through it. Other code keeps just its ID, not a direct pointer, so it can't reach in and break the rules.

open as a page

In a layered application built with Domain-Driven Design, what is the basic difference between an 'application service' and a 'domain service'?

level: juniorimportance: must knowfreq 70%
basics
~20 s

An application service coordinates a use case — starts transactions, checks permissions, calls objects, converts data — without deciding business rules. A domain service holds business rules that don't fit one entity, like a rule spanning two accounts.

open as a page

In Domain-Driven Design, what is a domain event, and why is it conventionally named in the past tense, like 'OrderShipped' rather than 'ShipOrder'?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A domain event is a note that something meaningful already happened in the business, e.g. 'OrderShipped'. It's named in the past tense because it records a fact that occurred, not a request asking for something to happen.

open as a page

In Domain-Driven Design, what is a Domain Service, and what's a simple example of when you'd need one instead of putting a method on an entity or value object?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A Domain Service holds business logic that doesn't fit on one specific object. You use one when an operation needs several objects together, or is really an action rather than a 'thing' - like transferring money between two accounts.

open as a page

In Domain-Driven Design, what is the core difference between an Entity and a Value Object, and why does that difference change how you implement equality checks (equals/hashCode) for each?

level: juniorimportance: must knowfreq 80%
basics
~20 s

An Entity is something with its own identity that stays the same over time even if its details change — like a person has one ID for life. A Value Object has no identity of its own; it's just described by its data, so two Value Objects with the same data are treated as equal and interchangeable.

open as a page

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

open as a page

In the context of Domain-Specific Languages (DSLs), what is the difference between an internal (embedded) DSL and an external (standalone) DSL, and can you give a concrete example of each?

level: juniorimportance: must knowfreq 55%
basics
~20 s

An internal DSL is written using the normal syntax of an existing programming language, just arranged to read like a mini-language for one job (e.g. a Kotlin build script). An external DSL has its own custom syntax and needs its own parser to be understood, like SQL or a regular expression.

open as a page

What is OMG's Model Driven Architecture (MDA), and what is the difference between a Platform-Independent Model (PIM) and a Platform-Specific Model (PSM)?

level: juniorimportance: must knowfreq 55%
basics
~20 s

MDA is a way of building software by first drawing a model of what the system does, ignoring the technology, then turning that model into one tied to a specific technology (like Java or a database), and finally generating code from it.

open as a page

When keeping a UML or domain model in sync with running code, what is the difference between 'forward engineering' (generating code from a model) and 'reverse engineering' (deriving a model from existing code)?

level: juniorimportance: must knowfreq 65%
basics
~20 s

Forward engineering writes the model first, then a tool generates code from it. Reverse engineering starts from existing code and builds or updates a model to describe it. Same goal—keep model and code matching—different starting point.

open as a page

In model-driven development, one kind of transformation turns a model into working code or documentation, while another kind turns one model into a different model. What is the practical difference between these two kinds of transformations, and why does the choice matter for a real pipeline?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Model-to-text turns a model into plain text, like source code, mostly a one-way trip. Model-to-model turns one structured model into another structured model, so it stays machine-readable and can be transformed again.

open as a page

In Martin Fowler's data source architectural patterns, what is the Active Record pattern, and what two responsibilities does a single Active Record object combine into one class?

level: juniorimportance: must knowfreq 70%
basics
~10 s

Active Record is a design where one class both holds the data fields of a database row (like name, price) and has methods to save, load, and delete itself from that row's table.

open as a page

What is the Transaction Script pattern for organizing business logic, and what does a single script typically do?

level: juniorimportance: must knowfreq 55%
basics
~20 s

A Transaction Script is one procedure that handles a single business request end to end: it reads input, runs the rules step by step, talks to the database, and returns a result. No shared object model, just a top-to-bottom recipe per action.

open as a page

What is a Data Transfer Object (DTO), and why would a service return a DTO instead of directly serializing its internal domain or persistence entity objects to a client?

level: juniorimportance: must knowfreq 85%
basics
~20 s

A DTO is a plain object built just to carry data across a boundary, like a network call. Services return DTOs instead of internal objects so clients don't depend on internal details that might change, break, or leak sensitive data.

open as a page

In enterprise integration, three common message types are commands, events, and queries. What distinguishes them, and how does each affect coupling between sender and receiver?

level: juniorimportance: must knowfreq 55%
basics
~20 s

A command tells one system to do something specific, like 'ship this order.' An event announces that something already happened, like 'order shipped,' and anyone can listen. A query just asks for data without changing anything. Each creates a different kind of dependency between sender and receiver.

open as a page

In plain terms, what is the Lazy Load pattern, and why would a system delay loading an object's data instead of fetching everything up front?

level: juniorimportance: must knowfreq 60%
basics
~20 s

Lazy Load means you don't fetch data until you actually need it. Instead of loading a whole object graph at once (which can be slow and wasteful), you load the minimum needed now and fetch the rest later, only if code actually asks for it.

open as a page