A common assumption has aged badly: AI will write the code, so studying design patterns is obsolete. A design pattern is a named, proven way of organising code for a problem that keeps coming up. This post is for developers who now review more AI-generated code than they write: knowing patterns by name matters more in that job, not less.
The first half of the assumption is coming true — a growing share of code is generated, not typed. The second half inverted. Now that engineers write less of the code themselves, the ability to recognize structure at a glance — to say “this is a Strategy,” “this wants to be a Decorator,” “this is global state hiding in a static class” (data that any part of the program can change) — has quietly become the skill that pays off most in the review chain.
Here’s the argument, from someone who teaches patterns and ships with AI tools daily.
First, the words
These are the only terms you need to follow this post. Each one is explained again where it first appears.
- Design pattern — a named, proven way of organising code for a problem that keeps coming up.
- Code review — a colleague reading a change before it is accepted.
- Diff — the line-by-line difference between the old and the new code; what a reviewer reads.
- Code smell — a visible symptom, such as the same block copied six times, that hints the structure is wrong.
- Strategy — interchangeable ways of doing one job, each in its own class, swapped instead of a growing if/else chain.
- Decorator — a wrapper that adds behaviour such as logging around existing code without changing or copying it.
- Adapter — a translator between your code and someone else’s, so their types don’t leak into yours.
- Facade — one simple entry point that hides a complicated sequence of calls.
Why does AI-generated code make patterns more important, not less?
Because review replaced writing as the bottleneck (the slowest step), and patterns are the vocabulary of review. When you wrote code yourself, structural understanding came for free — you’d made every decision. A generated diff (the changed lines) arrives decision-free: plausible, compiling, and structurally unexamined. The reviewer who can name what they’re looking at evaluates a long diff quickly (“Factory, fine; but this retry logic wants to be a Decorator, not copy-paste in six handlers” — a Factory decides in one place which class to create; a handler serves one kind of request). The reviewer who can’t name things reads line by line — or worse, skims and approves.
Naming is compression. “This should be Strategy” replaces a long explanation of why a switch statement over behavior types will hurt — a conversation I’d expect to come up often in reviews of generated code, because models tend to reproduce the most common solution in their training data (the code they learned from), and the most common solution is often a pile of ifs.
Don’t the models already know the patterns?
They know the patterns the way a library knows its books. Ask for a Strategy implementation and you’ll get a textbook one. But the hard part of patterns was never implementation — it’s selection: knowing that this tangle of conditionals is three strategies wearing a trench coat, or that the “flexible” abstract factory (interfaces for creating families of related objects) the model produced is speculative generality (machinery for variants that may never exist) for a problem with exactly one variant. Models make the selection error in both directions: under-patterned duplication when the prompt (the instruction to the model) is narrow, and over-patterned ceremony, layers that add structure but no value, when the prompt says “make it extensible.”
Selection requires knowing the forces a pattern resolves (competing pressures, such as flexibility against simplicity) and the cost it charges — which is precisely the part the patterns course spends its time on: not “here’s the UML” (class diagrams), but “here’s the smell (the visible symptom), here’s the moment the pattern earns its complexity, here’s the moment it doesn’t.” That judgment is what you bring to every generated diff you review.
Which patterns pay off most in AI-assisted codebases?
The composition patterns — my name for patterns that build behaviour by combining small objects: Strategy, Decorator, Adapter, Facade — because they’re the ones that keep repeated generation from becoming repeated duplication. A model asked for “add logging to these six handlers” will happily paste the same try/log/rethrow (catch the error, log it, throw it on) into six places; a reviewer with Decorator in their vocabulary turns that into one wrapper. Adapter and Facade earn their keep at AI-system boundaries specifically: tool interfaces for agents (functions an AI agent may ask your program to run; see AI Agents and Tool Calling Explained from Zero and MCP for Engineering Teams, MCP being an open standard for plugging tools into AI apps) are essentially Adapters, and every sane integration with an LLM (large language model) hides the provider behind a Facade so the vendor can change without the codebase noticing.
Then there’s Chain of Responsibility — a request passes along a line of handlers, each doing one job — reborn as middleware (code that runs on every request before or after your own) in agent frameworks. If you can see the classic structure inside the fashionable wrapper, framework churn stops being relearning and becomes recognition — which is why I’d expect engineers with pattern fluency to pick up agentic coding workflows, where an AI agent edits your repository (see Claude Code in Production: What I Learned in 6 Months), quickly: hooks (scripts that run before or after an agent’s action), sub-agents (helper agents for side jobs) and pipelines (chains of automatic steps) are structures they already have names for.
Concretely, this is the lookup table I wish every reviewer of generated code had taped to their monitor. The third column matters most: a named request is actionable.
| Pattern | The smell in generated code | What to say in review |
|---|---|---|
| Strategy | A switch or if-else chain over behaviour types that grows every sprint | “These branches are strategies — extract one per behaviour” |
| Decorator | The same try/log/retry block pasted into six handlers | “This is one wrapper, not six copies” |
| Adapter | Provider SDK types leaking into your domain code | “Put an adapter at the boundary; the domain shouldn’t know the vendor” |
| Facade | Callers orchestrating five subsystem calls in a specific order | “Hide that sequence behind one entry point” |
| Factory | Direct construction of concrete types scattered across call sites | “Centralise construction; callers shouldn’t be picking implementations” |
| Chain of Responsibility | One function doing auth, validation, logging and business logic in sequence | “This is middleware — one stage per concern” |
| Speculative generality (a code smell, not a pattern) | An abstract factory and interface hierarchy serving exactly one implementation | “One variant doesn’t need a hierarchy — delete the abstraction until a second appears” |
How should you actually review generated code for structure?
Review in two passes with different questions. Pass one, structural: What pattern is this trying to be? Is there duplication that wants a name? Is there ceremony that wants deleting? You’re not reading lines yet — you’re reading shapes, and it takes minutes. Pass two, semantic: now read the lines that survived pass one. In my view, many teams do only pass two, which is how generated duplication accumulates — line-by-line reading verifies each copy is individually correct and never notices there are six of them.
Example: one Decorator instead of six copies
An illustrative example in C#. Asked to add error logging to six request handlers, a model produces this six times:
// Before: generated, and pasted into six handlers
public async Task<Order> Handle(GetOrder query)
{
try
{
return await _orders.GetAsync(query.Id);
}
catch (Exception ex)
{
_logger.LogError(ex, "GetOrder failed");
throw;
}
}
Every copy is correct, so pass two approves all six. Pass one sees the shape — the same wrapper around different business logic — and names it: Decorator. Logging moves into one class that wraps any handler; each handler keeps only its own job:
// After: one Decorator; GetOrder, Order and IOrderRepository are the app's own types
public interface IHandler<TRequest, TResult>
{
Task<TResult> Handle(TRequest request);
}
public sealed class GetOrderHandler(IOrderRepository orders) : IHandler<GetOrder, Order>
{
public Task<Order> Handle(GetOrder query) => orders.GetAsync(query.Id);
}
public sealed class LoggingHandler<TRequest, TResult>(
IHandler<TRequest, TResult> inner, ILogger logger) : IHandler<TRequest, TResult>
{
public async Task<TResult> Handle(TRequest request)
{
try
{
return await inner.Handle(request);
}
catch (Exception ex)
{
logger.LogError(ex, "{Request} failed", typeof(TRequest).Name);
throw;
}
}
}
// Wiring: new LoggingHandler<GetOrder, Order>(new GetOrderHandler(repository), logger)
The review comment that gets you from the first block to the second is one line: “This is one wrapper, not six copies.”
You can only review what you can name.
Make the structural pass teachable by making it verbal: reviewers name the pattern (or the smell) in the review comment. “Extract Strategy here” is actionable and educational; “this feels messy” is neither. Teams that adopt the naming habit build a shared structural vocabulary — and that vocabulary keeps paying off as it grows, because the advanced C# course material on reflection, collections and async patterns all lands differently once the Gang of Four (GoF) catalogue, the classic book most of these names come from, is in place.
The inversion, stated plainly
We used to learn patterns to write better code, and the writing practiced the patterns. Now the writing is increasingly free, which means the practice is gone — and the judgment has to come from deliberate study, because review is where the judgment gets exercised. Pattern literacy in 2026 is not an architecture elective; it’s the reading skill that determines whether AI-assisted development compounds into a clean codebase or a beautifully-formatted landfill. Learn to name what you see. The models won’t do that part for you.