Chapter ai · Reference · DDD and Artificial Intelligence

DDD and Artificial Intelligence

What Eric Evans, Martin Fowler, Kent Beck, DHH, and others say about DDD and artificial intelligence: their positions, arguments, and data.

Author M. Katuščák
Reading time ≈ 24 min
Difficulty introductory
Published · Updated ·
In this chapter

The arrival of LLMs raised a question: does Domain-Driven Design gain value, or does it only add complexity at a time when AI generates code from a short description?

This chapter maps what leading figures in software engineering say about DDD and artificial intelligence: Eric Evans, Martin Fowler, Kent Beck, Vaughn Vernon, Nick Tune, Alberto Brandolini, and DHH. It is an overview of their positions, arguments, and data, not a defense or a critique of any particular approach. The opposite direction of the same relationship, DDD as a method for building a system with a language model inside it, has a section of its own, section ai.05.

Each statement carries the year it was made, and the overview reflects the state of things as of September 2026. Positions on this topic shift month by month, so parts of this text will age faster than the rest of the book.

ai.01 Ubiquitous Language as an interface for LLMs#

One of the most concrete proposals comes from Eric Evans. At Explore DDD 2024, he proposed fine-tuning a model on the Ubiquitous Language of a single Bounded Context, that is, on the terminology, rules, and expressions the team uses every day in discussions with domain experts. In his view, a fine-tuned model is a Bounded Context in its own right, and several such models side by side give a strong separation of concerns. Fine-tuning also makes an inexpensive model cheaper and faster than an expensive one.

This is a proposal, not a report on a completed experiment. Evans himself added the caveat that his conclusions hold as of the day he stated them, in March 2024.

“Because some parts of a complex system never fit into structured parts of domain models, we throw those over to humans to handle. Maybe we'll have some hard-coded, some human-handled, and a third, LLM-supported category.”

– Eric Evans, Explore DDD 2024 (via InfoQ)

In the same talk, Evans predicted that natural-language processing tasks would become full-fledged subdomains of a DDD model. Intent classification, entity extraction, and document summarization are typical examples. Just as teams have separate Bounded Contexts for payments, notifications, or the warehouse today, they will have a context for “understanding text” or “extracting structured data.” The prediction matches how large companies build their AI platforms. These are internal services with their own API boundaries, not a cross-cutting layer spread over the whole system.

Martin Fowler picks up the thread from a different angle. In an interview about preparing for nondeterministic computing (2025), he names domain-driven design and domain-specific languages as a path toward more rigorous prompting of LLMs. Unmesh Joshi worked the argument out in detail in an article on Fowler's site. A general-purpose language offers many ways to express the same intent; a DSL cuts that variability off. The model then needs only a few examples and generates the syntax reliably. A fixed language at the input means less entropy at the output.

David Heinemeier Hansson (DHH) holds the opposite pole. On the Lex Fridman Podcast (2025), he argued that Ruby has a higher communication bandwidth than other languages because each character carries more meaning. When working with AI, he sees that as an advantage: both the human and the model need to understand the code quickly. So DHH does not bet on a formal domain language but on density of expression and on framework conventions.

Rails 8.1 fits the picture with native Markdown rendering; the release notes justify it by saying that Markdown has become the lingua franca of AI tools.

Large language models work with natural language as their primary medium. The Ubiquitous Language of DDD is a precise subset of natural language: domain terminology stripped of ambiguity and enriched with domain rules. That makes it a bridge between domain experts and LLMs, because terms people understand are terms the model understands too. The open question is whether the cost of building and maintaining a Ubiquitous Language matches the benefits it brings. The answer varies from project to project. The definition and role of the Ubiquitous Language in DDD are covered in DDD Building Blocks.

ai.02 Bounded Contexts and the quality of generated code#

There is no hard data yet on how Bounded Context boundaries affect code generated by LLMs. A controlled study with a defined methodology and sample is missing. What exists are practitioners' experiences, code quality measurements that say nothing about DDD, and one preprint that makes no comparison. The confidence of the conclusions in this section reflects that.

The only concrete numbers on the topic come from a blog post by James Phoenix. Accuracy of around 55% without explicit boundaries versus 88% with them. Architectural boundary violations in 35% of cases versus fewer than five percent. The author presents them as his own estimate, with no methodology and no sample, so this chapter builds nothing on them. They remain an illustration of what practitioners observe.

Nick Tune is one of the most active practitioners where DDD and AI meet. In an article for O'Reilly Radar (February 2026), he describes using Claude Code to reverse engineer a software architecture, that is, to map end-to-end flows, dependencies, and boundaries in an existing codebase automatically. A follow-up article shows how the ts-morph library can deterministically extract architectural patterns that then serve as input for AI agents. Tune attaches a warning to the result himself: the generated architecture description contained substantial inaccuracies that he had to find and correct.

The book draws its own inference from this: an agent working inside a single Bounded Context needs to know less, and the less it has to guess, the fewer mistakes it makes.

Tools have meanwhile moved in a similar direction. Cursor, GitHub Copilot, and Claude Code read files with rules, terminology, and constraints for a specific part of the code, which resembles a Bounded Context with its Ubiquitous Language. The formats are discussed in section ai.06.

The resemblance has a limit, though, and Tune points it out from his own experience: generated code does not reliably follow architectural rules written down in Markdown files. His conclusion is therefore the opposite of what the analogy would suggest. Architecture has to be enforced deterministically, not described in the hope that the agent follows it.

A second perspective comes from GitClear data. Code churn is the share of lines rewritten or deleted within two weeks of being written; the company announced its doubling in January 2024 as a projection. Later reports rest on measured values. The share of lines associated with refactoring fell from a quarter in 2021 to under a tenth in 2024. Cloned lines rose from 8.3% to 12.3%, and copy-pasted code overtook moved code for the first time. The 2026 report, based on a sample of 623 million changes, shows block duplication 81% higher than in 2023. None of these measurements mentions DDD or proves causation; they show only which way code quality has moved in the era of assistants.

Each file or function can still be syntactically correct and work for its immediate purpose. The friction appears in larger units: boundaries between modules, preserving invariants, consistent naming across the whole codebase. Bounded Contexts target exactly this kind of problem. What remains open is whether the existence of a Bounded Context is enough on its own, or whether an AI agent needs explicit instructions about every rule inside the context.

ai.03 Testing as a control mechanism for AI#

Kent Beck, who popularized TDD and created Extreme Programming, has been writing publicly about how AI changes programming since 2023. After trying ChatGPT for the first time, he wrote that the value of 90% of his skills had dropped to zero. According to a summary in The Pragmatic Engineer (June 2025), TDD is especially valuable when working with AI agents. Beck distinguishes two modes. In augmented coding, the developer uses AI as an assistant and keeps responsibility for the decisions. In vibe coding, by contrast, the developer accepts whatever the AI generates, without understanding it and without verifying it.

“In vibe coding you don't care about the code, just the behavior of the system. […] In augmented coding you care about the code, its complexity, the tests, & their coverage.”

– Kent Beck, Augmented Coding: Beyond the Vibes (Substack, 2025)

Tests serve as an objective signal here. When a test suite describes domain rules rather than implementation details, a failing test shows that the model has drifted from the intent. In collaboration with AI, TDD thus takes over part of the role of code review.

Tests are not a tamper-proof safeguard, though. Beck himself lists among the warning signs the moment an agent cheats by disabling or deleting tests so that they pass. The control mechanism works only as long as someone keeps watching it.

Martin Fowler offers a similar but less optimistic framing. In an interview reported by The New Stack (December 2025), he compares AI to a “dodgy collaborator,” a coworker whose output has to be reviewed carefully rather than accepted blindly.

His advice is to treat every slice of generated work as a pull request from such a collaborator: one who is very productive if you count lines of code, but whose work you cannot trust.

According to Fowler, the nondeterminism of LLMs changes the way we think about testing itself. Traditional testing assumes that the same input always gives the same output, and that does not hold for AI components. Fowler calls for new metrics and approaches but admits that the community is only at the beginning of that search.

The third voice belongs to DHH, and his statements are deliberately provocative. In a conversation with Lex Fridman (July 2025), also reported by The New Stack, he explains why he does not leave writing code to an assistant. He tried Cursor and Windsurf and turned them down. That is where his most quoted line on the topic comes from:

“I can literally feel competence draining out of my fingers!”

– DHH, The New Stack, 2025

DHH warns that a developer stops understanding the code they run in production and turns from an engineer into a caretaker of AI. He uses AI all day himself, only differently. What bothers him is accepting output uncritically, because it dulls the ability to spot a mistake.

Without understanding the domain, even tests are not enough. A developer who does not grasp the domain writes the wrong tests, and the AI then delivers code that passes them and is wrong anyway.

The risk has a concrete mechanism. A language model predicts a probable continuation of text. Nothing in it separates correct code from the code that appeared most often in its training data. A domain invariant is a statement of the opposite kind: it says what is not allowed, even when it would be common and look reasonable at first glance. An order is not edited after shipping, even though nine out of ten similar classes have a setter for it. This is where generation hits its limit, and it is also why an aggregate with an explicit invariant holds up better than an anemic model: a violation is visible in it.

Neither TDD nor code review is a DDD pattern, but the DDD community has historically been closely tied to both. Tactical patterns can be tested at the domain level without special preparation: an aggregate with invariants, a domain event as a contract. The aggregate defines a rule, a test verifies it, the AI generates the implementation, and the test reports any deviation. Such a cycle holds up better than tests of implementation details. Concrete strategies for testing DDD models are covered in Testing DDD: unit tests of aggregates, integration tests through Messenger, and contract tests between contexts.

ai.04 AI in domain complexity vs. CRUD#

In his Explore DDD 2024 talk, Evans proposed a taxonomy of software decisions with three categories; AI adds the third one. The first category is hard-coded decisions: rules that are absolute, fixed, and carry serious consequences when violated. An example is the requirement that a negative account balance must go through explicit approval. The second is human-handled decisions: situations so complex or sensitive that a human has to decide. The third, new category is LLM-supported decisions: situations where the decision can be reviewed and a mistake costs little. Evans gives no specific accuracy threshold; in practice it lies where review catches the remaining errors.

The taxonomy shows where AI belongs and where it does not. In insurance, banking, or healthcare, hard-coded decisions dominate and a mistake is expensive. These are exactly the domains where DDD brings the most value, and where AI is most dangerous if nobody sets its boundaries. LLM-supported decisions exist here too, for example document categorization or drafting a reply for customer support. They have to stay clearly separated from the hard-coded logic, though.

Vaughn Vernon adds a concrete technical pattern: the LLM as a “fix suggester” (Explore DDD 2024, via InfoQ). In Vernon's vision of self-healing software, a tool like ChatGPT reacts to runtime exceptions and proposes a fix in the form of a pull request. The proposal goes through review, human or automated, and only then is it applied. In this scenario, the Bounded Context defines the verification rules: what the LLM may change and what must stay untouched.

Microsoft's reference implementation eShop (formerly eShopOnContainers) shows the distinction on a practical example. The Ordering module uses full tactical DDD: aggregates, domain events, CQRS. The Catalog module is plain CRUD with Entity Framework. The split was deliberate, not a historical accident. Implementation complexity belongs where the domain complexity lies. With the arrival of AI, a new question joins this reasoning: where is the line between what AI can decide autonomously and where explicit domain rules must apply?

DHH offers a radical counterweight:

“A lot of people, I think, are very uncomfortable with the fact that they are essentially crud monkeys. They just make systems that create, read, update, or delete rows in a database and they have to compensate for that existential dread by over complicating things.”

– DHH, Lex Fridman Podcast, 2025

DHH says openly that a large part of developer work is “CRUD monkeying,” that is, writing applications that accept data, store it, and display it. In his view, a complex architecture is an unnecessary complication for them. A conclusion follows that DHH himself does not draw, because he does not leave writing code to an assistant: AI generates such code from a short description, and no domain model is needed for it. Evans and DHH differ mainly in their estimate of how large a share of the software industry consists of truly complex domains. It remains open whether AI will move this line. Either it makes CRUD code so cheap that time is left for the demanding domain, or complex domain problems shrink into LLM-supported decisions. When to adopt DDD and when not to is discussed in When Not to Use DDD.

ai.05 DDD when building a system that includes an LLM#

The previous sections deal with one direction: does DDD help when a model generates the code? Evans has meanwhile published material on the opposite direction. He describes how to model a system in which a language model is one of the components. Unlike the 2024 keynote, these are his own texts, and they work with patterns the book teaches elsewhere.

In the article AI Components for a Deterministic System (August 2025), Evans describes an application that uses an LLM to classify the domains in someone else's codebase. The name Domain Navigator appears in the follow-up text from January 2026. The useful part is the distinction that comes out of it: a classification task is not a modeling task. Classification is repeatable, has a correct answer, and the model excels at it. Modeling is not repeatable and has no correct answer. Mixed into one prompt, the two return outputs that cannot be compared between runs. Evans's solution: establish a canonical taxonomy first, and only then classify against it.

The second article, Context Mapping with an AI-based Component (January 2026), draws a Context Map of a system that has an LLM as one of its components. Its conclusions apply directly to design:

  • The LLM is a Bounded Context. It has its own language, its own consistency model, and its own contracts. Drawing it on the Context Map as a separate context is more accurate than treating it as a library.
  • The Anti-Corruption Layer is not optional. Translating between a deterministic application and a probabilistic component takes more than parsing JSON. The response is validated against the allowed taxonomy and only then mapped to a domain type. The pattern is described in Bounded Context and Context Mapping.
  • The context is named after the specific model, not a generic “LLM.” Models are not interchangeable.
  • The taxonomy belongs in the Published Language. Evans uses the NAICS classification; the shared vocabulary between the application and the model plays the same role as a Published Language between two teams.

Evans also admits that the line between an Anti-Corruption Layer and a Conformist is blurry in a real system. Whoever accepts the model's output format unchanged is a Conformist, and bears the consequences when the format changes.

In Symfony, the pattern takes a concrete shape. The domain interface belongs in Domain/, the adapter that calls the provider through symfony/http-client belongs in Infrastructure/, and validating the response and mapping it to a value object belong in that same adapter. Calling the model is I/O with latency, failures, and unstable output, so it belongs in a Messenger handler with a retry strategy, not in a synchronous pass through a controller. The layering is described in Architectural Styles and Implementation in Symfony 8.

The state of the PHP ecosystem as of September 2026: the php-llm/llm-chain package is marked abandoned on Packagist, with symfony/ai-agent as its replacement. Symfony AI exists as a set of components (symfony/ai-platform, -agent, -bundle, -store, plus bridge packages for individual providers) at the same version, 0.13.0. Development is active, but the 0.x series gives no backward compatibility guarantee. There is no standalone symfony/ai package.

ai.06 Architectural tools and context for AI#

Instruction files for agents have settled into a few formats. Cursor reads the .cursor/rules/ directory with .mdc files; each one carries rules, terminology, and constraints for a specific part of the project. GitHub Copilot reads .github/copilot-instructions.md, which holds global instructions for every conversation in the repository. Claude Code uses CLAUDE.md at the project level and in individual directories; this website has its own CLAUDE.md in the repository root. The tool-neutral AGENTS.md is read by most agents, including Cursor, Copilot, and OpenAI Codex; since December 2025, the format has been maintained by the Agentic AI Foundation under the Linux Foundation.

None of these formats refers to DDD, and none of the authorities cited here recommends them as Bounded Context documents. The resemblance is a matter of observation, not doctrine, and Tune's experience cited in section ai.02 shows where it ends: a rule written in Markdown is not an enforced rule.

As of September 2026, there is little academic work on the topic. A preprint by Wiegand et al., published on arXiv in January 2026 as part of the Upper-Rhine AI Symposium 2024 proceedings, examines whether generative AI can create domain metamodels. A Code Llama model fine-tuned on data from real DDD projects generates domain-specific JSON objects, and the authors measure whether they are syntactically correct. The answer is yes, even on an ordinary consumer graphics card.

This is, however, a proof of feasibility for a single approach, not a comparison. Whether structured context leads to better outputs than unstructured context is something this paper does not measure; it has no control group.

The ThoughtWorks Technology Radar does not mention DDD in connection with AI directly, but several of its blips belong to the topic. “Using GenAI to understand legacy codebases” has been in the Adopt ring since volume 33 (November 2025). The same volume introduced “Context engineering” and “Anchoring coding agents to a reference application,” both in Assess; volume 34 (April 2026) moved context engineering to Adopt. That turned an ad hoc practice into a named discipline: assembling for the model exactly the context it needs for the task. A tighter context means more precise outputs, and the Bounded Context is one answer to the question of where to cut it.

The same tools work without DDD, though. Code written according to clear conventions (convention over configuration) tends to be as readable for an agent as an explicitly modeled Bounded Context: with established naming, a decent test suite, and a readable directory layout, an agent finds its way around even without a formal domain model. The open question is what happens once a project outgrows the point where conventions are enough.

ai.07 Open questions and limits#

Martin Fowler repeatedly points out (for example, in December 2025) that the combination of AI and software architecture is only at its beginning. The nondeterminism of LLMs, where the same prompt returns a different output, has no satisfactory metric. Nobody knows yet how to measure the architectural consistency of generated code, or how to verify that AI respects the boundaries of a Bounded Context when every API call can return a different result. According to Fowler, the field is still learning this.

There is also no answer to where exactly generated code fails inside a well-defined context: in edge cases, in violated invariants, or in naming that diverges from the model. Without that, it is impossible to say whether a context boundary is a sufficient guarantee or merely shrinks the room for error. An additional layer of verification can come from architecture tests (deptrac, ArchUnit) or an explicit registry of contexts.

Alberto Brandolini, the creator of Event Storming, is on the side of combining approaches. His workshop AI-Powered Domain-Driven Design at Avanscoperta promises to apply AI tools where they have the greatest impact while keeping the learning that comes from hands-on exercises. Participants are expected to weigh lo-fi, hands-on, and AI approaches against each other and to know the limits of each. A statement of his own on how far Event Storming remains a human activity could not be found; as of September 2026, the workshop description is the only evidence of his position.

Sam Newman, author of Building Microservices, had not taken a clear position on AI in the context of DDD as of September 2026. His stance on distributed systems has long been conservative: microservices as a last resort, not as the default architecture. Carrying that restraint over to AI is this book's reasoning, not Newman's position. An LLM deployed into a production system is, however, a distributed dependency with all the problems of distributed systems: latency, reliability, versioning, and monitoring.

Open questions the field has no answer to yet:

  • Does AI move the line where DDD makes sense? If AI makes generating CRUD code cheap enough that developers have more capacity left for complex logic, DDD may pay off even where it does not today.
  • Will the Ubiquitous Language become a standard for AI contexts? Cursor rules, CLAUDE.md, and AGENTS.md unify the file format, not its content. Could the DDD community contribute a more formal structure for defining AI contexts?
  • What will the architect's role be in an AI-augmented team? If AI generates the implementation, the architect becomes mainly an author of contexts, rules, and verification mechanisms. That is closer to DDD modeling than to writing code.
  • What happens to junior developers? DDD assumes that the team understands the domain. If AI generates code that juniors do not understand, how does the next generation build domain knowledge?

ai.08 Conclusion#

Taken together, the positions lead to a cautious but fairly consistent conclusion. Most of the people named here see a potential synergy between DDD principles and working with AI. Evans is the most concrete, because he is the only one who has published his own model of a system with a language component. Fowler and Beck are cautiously optimistic; Fowler calls for new tools and metrics, Beck for discipline through tests. Brandolini lets AI into modeling workshops and leaves it to participants to weigh where it helps and where it gets in the way.

DHH provides an important dissenting voice. He reminds us that a large part of the software industry is still CRUD, that simplicity has its own value, and that AI can be effective even without formal domain modeling. His position does not contradict DDD. It only shows that DDD does not have an answer to every question.

One thing remains that nearly everyone agrees on: structure helps. An explicitly described, shared context improves AI results, and DDD offers a proven vocabulary for describing it. Tune's experience adds a limitation that enthusiastic texts tend to overlook: described structure is not enforced structure. Conventions, tests, and deterministic checks achieve a similar effect; together with a domain model, they work better than any of them alone.

The architectural decision therefore follows from the domain, the team, and the project: where the domain complexity lies, where a mistake is expensive, and whether the system will live for five years. The presence of AI in the toolchain does not decide it.

Frequently asked questions

Why would AI tools generate better code in projects with a Ubiquitous Language?

There are no controlled measurements of this yet, but the mechanism is clear. A Ubiquitous Language gives the LLM an unambiguous vocabulary that appears in documentation, tests, and code. While generating, the model receives consistent terms from the context and produces output that fits the existing model without translation. Without a Ubiquitous Language, AI often introduces its own naming that diverges from the domain, and the team then spends time rewriting it. In 2024, Evans built on this his proposal to fine-tune an LLM directly on the vocabulary of a single Bounded Context. A detailed analysis is in the Ubiquitous Language as an interface for LLMs section.

How do Bounded Contexts affect the quality of AI-generated code?

A Bounded Context defines a comprehensible scope for the AI to work in. Instead of “the whole application,” it works with one model, one set of rules, and one vocabulary. A smaller, well-bounded context means fewer contradictory pieces of information in the prompt and less room for hallucinations. Agent configuration files (Cursor rules, CLAUDE.md) define a similar perimeter, but practice shows that an agent follows a described rule less reliably than a rule enforced by a tool. The analysis is in the Bounded Contexts and the quality of generated code section.

What role do tests play when working with AI?

Tests act as a control mechanism that catches the gap between what the AI generated and what the domain actually requires. Kent Beck talks about augmented coding: the AI writes code, tests confirm the behavior, and only when both hold together does the change go into the codebase. Without tests, the risk of unresolved errors from AI output accumulates, because LLM code looks syntactically correct even when it fails at the level of behavior. The safeguard has a limit, though: Beck himself lists an agent that disables or deletes tests among the warning signs. A practical analysis is in the Testing as a control mechanism for AI section.

Where are the limits of AI in domain-complex code?

For now, AI handles routine tasks well (boilerplate, CRUD, simple transformations), but it struggles with code that reflects an inconsistent domain reality or requires modeling new rules together with stakeholders. Martin Fowler describes AI as a “dodgy collaborator” whose output has to be verified carefully, especially for operations where a mistake is costly. The open questions concern quality metrics for the domain model, the role of humans in Event Storming, and the long-term impact of AI on developers' skills. See the Open questions and limits section.

ai.09 Sources and further reading#