Sooner or later someone in a planning meeting asks, "So are we doing TDD or DDD?" It sounds like a fair question. It's a bit like asking whether the team uses Git or PostgreSQL. The answer can be yes to both, because each one works on a different part of the job.
The "-driven" suffix is the clue. Each name tells you what you start from, and what gets to push back on your decisions. In TDD a failing test comes first. In BDD it's an example of behavior that the business and the developers agreed on. In DDD it's the language and rules of the business itself. Read the names that way and the alphabet turns into a map. This post walks through it: what each one drives, a small example, where it helps and where teams usually trip.
These methods sit on different axes, which is why they stack so well:
• Testing and process: TDD, BDD, ATDD (when tests get written, and who writes them)
• Design: DDD (how you model the problem)
• Architecture: event-driven (how the parts talk to each other)
• Build approach: component-driven, feature-driven (which unit you build around)
TDD vs BDD vs DDD at a glance
| Aspect | TDD | BDD | DDD |
|---|---|---|---|
| Full name | Test-driven development | Behavior-driven development | Domain-driven design |
| What leads | A failing unit test | An example of behavior the team agreed on | The language and rules of the business |
| Kind of method | Testing practice | Testing and collaboration practice | Design approach |
| Who's involved | Mostly the developer | PO, QA and developers together | Developers and domain experts |
| What you write first | A test list, then one failing test | A Given/When/Then scenario | Shared words and context boundaries |
| Question it answers | Does this piece of code work? | Are we building the right behavior? | Where does this rule live, and what do we call it? |
| Typical tools | Any unit test runner | Cucumber, JBehave | None. It lives in the model and the code |
| Skip it for | Spikes and throwaway scripts | Scenarios nobody outside QA will read | Apps that are mostly forms over a database |
| Started by | Kent Beck, late 1990s | Dan North, written up in 2006 | Eric Evans, in a 2003 book |
For "TDD vs DDD", look at the "Kind of method" row. TDD is a way to write and test one function at a time. DDD is a way to shape the model and decide where its boundaries go. You can use both in the same sprint, often on the same feature.
TDD: a failing test drives the code
Kent Beck developed TDD in the late 1990s as part of Extreme Programming (Martin Fowler). Most people know it as red, green, refactor. Beck's own 2023 write-up of Canon TDD starts one step earlier, and that step is the one most summaries skip: write a list of the test scenarios you want to cover. Then turn exactly one item on the list into a real, runnable test, make it pass, optionally refactor, and go back to the list until it's empty.
// Test list (plain notes, no code yet)
// - an order over $100 gets 10% off
// - an order of exactly $100 pays full price
// - an empty cart costs 0
// 1. RED: turn one item into a real test. It fails, the function doesn't exist yet
test('takes 10% off orders over $100', () => {
expect(priceAfterDiscount(120)).toBe(108)
})
// 2. GREEN: the least code that makes it pass
function priceAfterDiscount(total) {
return total > 100 ? total * 0.9 : total
}
// 3. REFACTOR (optional): tidy up while every test stays green, then pick the next item
Writing the test first makes you decide how the function gets called before you get attached to how it works. Fowler points out a second effect: since you only write production code to answer a failing test, you end up with self-testing code almost by accident. The test list does its own job too. "Exactly $100" is the kind of edge case you spot while writing the list and forget once you're deep in the code.
Beck lists the mistakes himself, and they're worth a slow read: writing tests with no assertions to push coverage up, copying the value the code computed and pasting it in as the expected value, and mixing refactoring into the step where you're only trying to get to green. Fowler adds the most common one he hears about, which is skipping the refactor step entirely. Keep in mind what TDD can and can't promise. It tells you each unit does what you said. It can't tell you that you built the right feature. Whether the time pays off is a separate argument, and it has its own post: TDD: is it worth the time?
BDD: an agreed example drives the feature
Dan North came up with BDD while teaching TDD. People kept getting stuck on the same questions: where do I start, what do I test, what do I call the test (Introducing BDD, first published in 2006). His first fix was small. Name each test method as a sentence that starts with "should", and talk about behavior instead of tests. Then he showed the idea to Chris Matts, a business analyst, who said it sounded a lot like analysis. The two of them took the usual "As a, I want, so that" story and gave its acceptance criteria a fixed shape: Given some context, When something happens, Then expect an outcome.
Feature: Checkout discount
Scenario: Order over $100 gets 10% off
Given a cart totaling $120
When the customer checks out
Then the final price should be $108
Scenario: Order of exactly $100 pays full price
Given a cart totaling $100
When the customer checks out
Then the final price should be $100
Tools like Cucumber, or JBehave (which North wrote), wire each step to code, so the scenario runs as a test and stays up to date. The bigger win happens before any tooling, in the room. The PO, QA and the developer read the same few lines and argue about the $100 case while it's still a sentence and not a bug report. Fowler describes Given-When-Then as a way of writing specification by example, and the examples are the point.
TDD drives code from unit tests the developer writes. ATDD (acceptance test-driven development) drives a feature from acceptance tests everyone agreed on before the build. BDD grew out of TDD and ended up very close to ATDD, with more care for shared wording and concrete examples. In practice they nest: the scenario is the outer loop (is this the right feature?) and TDD is the inner loop (does each piece work?). There's a deeper walk-through in Behavior-Driven Development (BDD).
DDD: the business domain drives the model
Look at the last letter. DDD is domain-driven design. The name comes from Eric Evans's 2003 book, which lays the approach out as a catalog of patterns (Fowler on DDD). The patterns fall into two groups.
Strategic design, the boundaries:
- Ubiquitous language: one vocabulary shared by the domain experts and the code. If the claims team says "policy", the class is
Policyand nobody invents anInsuranceRecord. - Bounded context: a boundary inside which one model and its words stay consistent. Fowler's example is an electricity utility where "meter" can mean three different things depending on who's talking (Bounded Context). "Customer" in billing and "customer" in support are different models too. Forcing one shared
Customerclass on both is the classic way to make two teams unhappy at once.
Tactical design, the building blocks inside one context:
- Entity: has an identity that lasts over time, like an
Orderwith an id. - Value object: defined only by its values and never changed in place, like
Moneywith an amount and a currency. - Aggregate: "a cluster of domain objects that can be treated as a single unit". Outside code only holds references to its root, and transactions shouldn't cross aggregate boundaries (DDD Aggregate).
- Repository: lets you load and save aggregates as if they sat in an in-memory collection.
- Domain event: something that happened and matters to the business, like
OrderPlaced.
// The Order aggregate root guards its own rules
class Order {
addItem(product, qty) {
if (this.status !== 'DRAFT')
throw new Error('Cannot modify a placed order')
this.items.push({ product, qty })
}
place() {
if (this.items.length === 0)
throw new Error('Cannot place an empty order')
this.status = 'PLACED'
this.raise(new OrderPlaced(this.id))
}
}
The rule "you can't change an order after it's placed" lives inside Order, in one place. Nobody has to remember to check it in three controllers and a cron job. That's also why DDD pairs so well with Clean, Onion and Hexagonal architecture: all three exist to keep a model like this free of framework and database details.
Teams copy the tactical patterns (a folder called aggregates/, a repository per table) and skip the language and the boundaries. Evans pushed back on this himself. In Gojko Adzic's notes from Evans's 2009 QCon London talk, the building blocks are listed as over-emphasised and expressing context boundaries as essential (What I've learned about DDD since the book). If your app is mostly forms on top of a database, plain code will serve you better than a DDD costume.
Event-driven: facts drive the flow
Here the components stop calling each other directly. One side publishes a fact about what happened, and anyone who cares reacts on their own. "Something happened" replaces "do this now." A quick note on the acronym: "EDD" isn't settled, and some people now use it for eval-driven development (more on that below), so write the full phrase in design docs.
// The order service announces the fact. It doesn't know who's listening
eventBus.publish(new OrderPlaced({ orderId, total }))
// Independent consumers react on their own
onEvent('OrderPlaced', e => inventory.reserve(e.orderId))
onEvent('OrderPlaced', e => email.sendConfirmation(e.orderId))
Fowler points out that "event-driven" covers at least four patterns: event notification, event-carried state transfer, event sourcing, and CQRS, which often travels with events even though it isn't really about them (What do you mean by "Event-Driven"?). When someone proposes going event-driven, ask which of the four they mean. The answers lead to very different systems. Domain events from DDD are often what flows through these systems, which is why the two fit together so nicely.
Fowler's warning about event notification is that the overall flow can be hard to see, because it isn't written down in any one piece of code. Add ordering, duplicate delivery and eventual consistency, and you have real costs to carry. They're worth it when separate teams or services need to change without waiting on each other. For a small app where a function call would do, they're pure overhead.
Component-driven: the UI grows from the smallest piece
Component Driven describes it as building user interfaces from modular components, bottom up: build one component at a time in isolation, combine them into bigger ones, assemble pages with mock data, then connect the pages to real data and APIs. Storybook is the usual workbench.
// Build and review Button on its own, in every state, before any page uses it
export const Primary = { args: { variant: 'primary', label: 'Buy now' } }
export const Loading = { args: { loading: true } }
export const Disabled = { args: { disabled: true } }
The payoff is that every state of a button (loading, disabled, error) sits on one screen before any page depends on it. Designers and developers review the same thing, the awkward states get seen early, and two people can build two components at the same time without stepping on each other.
On the backend, CDD often means contract-driven development. With consumer-driven contracts, the consumer's own tests produce the contract, and the provider checks that it can honor it. Pact calls contract testing "a technique for testing an integration point by checking each application in isolation" (Pact docs). Same spirit, a different layer: the contract leads, both sides test against it.
FDD: small client-valued features drive delivery
Feature-driven development was devised by Jeff De Luca in 1997 for a bank project in Singapore, and first written up in a chapter of Java Modelling in Color with UML (1999) by Peter Coad, Eric Lefebvre and De Luca (Wikipedia). It has five activities: develop an overall model, build a feature list, plan by feature, then design by feature and build by feature, repeated for each feature. Features follow a naming template, "action, result, object", as in "calculate the total of a sale". In Grant Cause's Methods & Tools article, a feature is anything that takes 1 to 10 days to build, and most take 1 to 3.
So FDD is a way to run delivery. It sits much closer to Scrum than to TDD. You rarely hear the name today, but the habit of slicing work into small features a client would recognize will look familiar from almost any backlog.
The newer and niche members
- Type-driven development: design the types first, so the compiler rejects bad states before any test runs. Yaron Minsky's Jane Street post puts it as "make illegal states unrepresentable", with an example that swaps one record full of optional fields for separate
Connecting,ConnectedandDisconnectedvariants (Effective ML Revisited). - Model-driven development (MDD): generate code from higher-level models. You'll meet it in regulated industries and low-code platforms.
- Eval-driven development: the newest member, for features built on LLMs. The same correct answer can come out in many shapes, so pass/fail asserts don't fit. You build evals instead: sets of realistic inputs with a way to grade the outputs. Anthropic's guide (checked November 2026) says to start from success criteria that are specific and measurable, to mirror the real task mix including edge cases, to automate grading where you can, and that more questions with slightly lower-signal automated grading beat fewer hand-graded ones (Create strong empirical evaluations). That's the TDD habit of "define the target first" applied to systems that aren't deterministic. More on how this shifts the work in How AI is changing every role on a software team.
One feature, several drivers
Put it together on one checkout discount feature and each method gets its own layer:
| Layer | Method | Its job on the feature |
|---|---|---|
| Shared understanding | BDD / ATDD | Agree on the behavior in Given/When/Then, including the $100 edge case |
| Design | DDD | Decide the discount rule belongs to Order in the checkout context |
| Code | TDD | Drive priceAfterDiscount from a test list, one failing test at a time |
| Architecture | Event-driven | Publish OrderPlaced and let inventory and email react |
| UI build | Component-driven | Build the discount badge and checkout button in Storybook, every state |
The scenario is the outer loop: it goes green when the checkout discount works for a real customer. TDD is the inner loop that turns over many times inside it. DDD decides what those units are and where the rules live, and events connect the pieces after the order is placed. Nobody has to announce "we do five DDs". The team just uses the right driver at the right layer.
Pick by problem, not by identity
A method is a tool you pick up for a layer of the work. A few rules of thumb:
- Match the driver to what hurts. Rich rules and messy business language call for DDD, starting with the language and the boundaries. Logic full of edge cases calls for TDD. If business and developers keep misreading each other, try BDD scenarios. Services owned by different teams can use events or contract tests. A shared UI kit is a good fit for component-driven work. For simple CRUD, keep it plain.
- Ask "which driver does this layer need?" instead of "which one are we?"
- Watch for rituals with no purpose behind them: an
aggregates/folder with no rules inside, Gherkin files only QA ever opens, a test suite written after the fact and called TDD. - Be wary of blanket rules like "TDD for everything". They end up applied to spikes and throwaway scripts too, where they add ceremony and catch nothing.
Try this week
- Next time someone asks "TDD or DDD?", ask which layer of the work they mean.
- Before your next ticket, write a test list of three to five scenarios before any code. It's Beck's first step and it takes five minutes.
- Write one Given/When/Then scenario for a real feature with the PO and QA in the room, then note where the three of you disagreed.
- Find one business word your codebase uses with two meanings. There's a good chance it marks a context boundary.
- If someone proposes going event-driven, ask which of Fowler's four patterns they have in mind.
The alphabet looks scary until you read the suffix: each name just says what leads. Tests, behavior, the domain, events, components, features. Pick a lead for each layer of the feature in front of you and leave the rest in the toolbox for the next one.