Skip to main content

Command Palette

Search for a command to run...

Why DDD Matters More in the Age of AI-Generated Code

Generated code is cheap. Domain clarity is scarce.

Updated
10 min read
Why DDD Matters More in the Age of AI-Generated Code

AI has changed something for me personally.

For the first time in a while, software feels more like creating again. Not just typing code, debugging strange edge cases, wiring things together, and slowly pushing tickets forward. With AI, I can move from an idea to something visible much faster. I can test a thought, generate a rough implementation, throw it away, try another angle, and shape the result into something useful.

That has brought back some of the spark that made software interesting to me in the first place.

Maybe that is a strange way to start a post about Domain-Driven Design. But it is also why I have become more interested in DDD again.

The more useful AI becomes, the more I worry about what we are asking it to amplify.

AI can generate code faster than most organizations can understand what they are actually trying to build. That is a great capability when the thinking is clear. It is a problem when the thinking is vague.

The risk is not only that AI writes bad code. Bad code can be found, reviewed, tested, rewritten. The harder problem is when AI turns ambiguous thinking into a working system.

A vague idea becomes a service. A misunderstood rule becomes an API. A weak assumption spreads into enough artifacts that it starts to look established. The code, tests, documentation, and contracts may all agree with each other and still be wrong about the domain.

This is the reason I keep coming back to Domain-Driven Design. Not because every system needs more patterns. Not because I think DDD is some kind of silver bullet. Mostly because DDD gives us ways to be more precise about meaning before we scale implementation.

It slows down the parts that should probably be slower: language, ownership, boundaries, and assumptions. These things feel more important when implementation gets faster.

The bottleneck has moved

A lot of the AI discussion in software uses the language of productivity. I understand why, but I think the word is often used too casually.

It is easy to count generated lines of code, completed tasks, removed boilerplate, or how much an AI agent can do without human help. Those things may tell us something about output, but they do not tell us much about whether the work was useful.

Software productivity is only real if we are building the right thing, or at least learning faster what the right thing might be. Otherwise we are just producing more artifacts around the same uncertainty.

In many real systems, the painful problems are not caused by slow typing. They come from unclear concepts, vague ownership, overloaded words, and software that no longer matches how the business works. AI does not automatically fix that. Sometimes it makes it easier to hide the problem under more output.

If the domain is unclear, AI can still generate code. If the boundaries are wrong, AI can still generate code. If two teams use the same word to mean different things, AI can still generate code.

And the generated code may look fine. It may compile, have tests, and follow common patterns. None of that guarantees that it represents the right business concept.

This problem existed before AI. AI just removes some of the friction that used to slow it down.

Weak models spread faster now

Weak domain models have always caused problems. They show up as confusing integrations, surprising edge cases, and long arguments about what a word actually means.

Before AI, these problems often spread more slowly. A workaround took effort. An integration took effort. A local interpretation of a rule had to be implemented by someone, usually after some discussion and delay.

Now a weak model can spread into more artifacts in less time: APIs, tests, generated clients, documentation. All of it can appear quickly. All of it can make the model feel more real than it deserves to be.

This is the part I find uncomfortable: AI increases the importance of architectural judgment because it reduces the friction of implementation. The easier it becomes to create software, the more important it becomes to decide what software should exist.

That decision depends on domain understanding.

What is this concept called? Who owns it? What does it mean in this context? What should other parts of the system be allowed to know? What should remain private?

These are DDD questions, even if we do not call them that.

DDD helps us learn from the domain

For a long time, I thought about DDD mainly as a way to design better software models. I still think that is true, but it feels incomplete.

DDD is sometimes presented as if the goal is to design the correct model and then implement it. Real domains rarely work like that. We discover them through conversations, edge cases, usage, incidents, and business change.

A domain model is not just a diagram or a set of classes. It is a working theory about how part of the world behaves. And like any theory, it improves when it meets reality.

This is probably the part of DDD that interests me most right now. AI can help us move faster, but speed alone is not much of a strategy. I want the learning loop to become faster: create a model, test it against reality, notice where it fails, and improve it.

DDD gives that loop some structure. We model part of the domain. We make language and boundaries explicit. We observe where the model fits reality and where it breaks. Then we refine the model.

AI can help with pieces of that work. It can summarize domain conversations, compare code against documentation, and help explore alternative models. That is useful. But it still needs a meaningful frame.

Without that frame, AI is powerful but directionless. With a good frame, it has a smaller and more meaningful world to work inside.

DDD is more than tactical patterns

When people hear Domain-Driven Design, they often think about aggregates, entities, value objects, repositories, domain services, and layered architecture. Those patterns can be useful, but they are not the part I am focusing on here.

The more important part is alignment between software and domain understanding.

DDD asks us to take the business seriously as a design input. It asks us to model language, boundaries, behavior, and ownership. It asks us to notice when the same word means different things in different contexts.

That matters when AI enters the development process. AI can generate code inside a model, suggest implementations, and help explain existing logic. But it needs boundaries around meaning.

A bounded context gives it those boundaries.

Inside this boundary, these words mean this. These rules belong here. This model is owned by this team. Other contexts should not reach directly into the internal model; they interact through contracts, events, or published representations.

For me, that is the practical value. The words, rules, and ownership are not floating around the system anymore. They have a place, a context.

AI needs narrower context, not just more files

One common reaction to AI limitations is to add more context to the prompt. I have done this myself: more documents, more code, more instructions.

Sometimes it helps. It can also make things worse.

A large pile of mixed information can confuse humans, and it can confuse AI. If the information mixes business meanings, deprecated APIs, and conflicting terminology, the AI may produce an answer that sounds coherent but blends concepts that should remain separate.

This is the part of DDD that now feels surprisingly practical for AI: bounded contexts narrow the relevant world.

They tell both humans and AI which part of the domain we are working in, which concepts matter here, what the words mean, and which contracts connect this context to others.

That narrower context is not a limitation. It is what makes useful reasoning possible. An AI assistant working inside a clear bounded context has a better chance of producing useful output than one pointed at a large, mixed, inconsistent repository and asked to “understand the system”.

A bounded context gives an AI assistant a smaller world to reason about. Often that is more valuable than simply giving it more files.

Design still matters

There is a tempting story that AI will eventually remove the need for much of software design. We describe what we want, and the system builds it.

I do not think that is the right mental model.

Even if AI becomes much better at implementation, someone still has to frame the problem, define the boundaries, choose the language, and create feedback loops so the model can evolve when reality proves it wrong.

That work becomes more important as implementation gets easier.

This does not mean architects should sit in a room producing big models before anyone writes code. Domain understanding improves through conversation, delivery, observation, and correction.

AI can participate in that work. It can summarize conversations, extract concepts from code, and help teams see where boundaries are being violated.

Humans still need to decide what the model should mean. The domain comes from the business, the users, the constraints, the edge cases, and the people who live with the consequences of the system.

Domain-Driven AI

That is the idea behind this series.

I am writing it partly to clarify my own thinking. AI is moving quickly, and it is easy to get pulled into tool discussions and impressive demos. I want to keep asking a more basic design question: how do we keep software grounded in the domain when generating software becomes easier?

Domain-Driven AI is not a new methodology. At least I do not see it that way. It is a way of looking at AI-assisted software development through a DDD lens.

The basic thesis is simple: as AI makes software cheaper to generate, domain understanding becomes the scarce resource.

If we want AI to help us build better systems, we need to give it better structures to work within: better boundaries, better language, better ownership, and better feedback loops.

DDD gives us many of those structures. It helps us avoid treating AI as a magic code generator operating over an undefined problem space. It helps us place AI inside bounded contexts, published contracts, domain language, and explicit models of ownership.

That is where AI becomes useful in a more interesting way. It is not only about generating more code. It is about helping us create software that remains understandable, adaptable, and grounded in the real-world domain it is supposed to serve.

When implementation gets cheaper, context becomes the constraint

This is the shift I want to explore, not as a finished theory, but as a working line of thought.

If code becomes cheaper, we should become more careful about context.

Before we generate implementation, we should ask what domain we are in, what the concept means here, who owns the decision, what assumptions we are encoding, and how we will know if the model is wrong.

Those questions decide whether AI-assisted development produces useful systems or just accelerates accidental complexity.

That is why DDD matters more now. AI is powerful enough to make weak models dangerous, and that means our models, boundaries, and language deserve more attention, not less.


This is the first post in the Domain-Driven AI series. Next, I want to look more closely at the idea of context itself: why giving AI more material is not always the same as giving it better context, and how DDD’s idea of bounded context might help us work with AI more deliberately

Domain-Driven AI

Part 1 of 1

A series about why domain-driven design becomes more important in the age of AI-generated code, not less.