Article · Blog
The pattern you introduced to reduce complexity created a new layer of indirection that nobody knows how to navigate
Design patterns don't fail because they're bad. They fail because they solve the wrong problem in the wrong context. And the cost shows up months later, when the team that wasn't part of the decision tries to understand the code.
The pattern you introduced to reduce complexity created a new layer of indirection that nobody knows how to navigate
On an investments project I worked on, there was a Coordinator.
It was beautiful. Clean hierarchy, decoupled navigation, no ViewController knowing about the next one. The team that built it was proud. And rightfully so: the pattern works on paper.
The problem showed up when I needed to understand the deposit flow. I spent forty minutes following references. The DepositViewController called the coordinator. The coordinator called a parent FlowCoordinator. The parent delegated to an AppCoordinator. The AppCoordinator had a switch with twenty cases. Somewhere in there, the deposit flow was happening.
Nobody on the team knew off the top of their head where it was. Everyone opened Xcode and hit Command+Shift+F.
That's not a Coordinator problem. It's the symptom of a pattern that grew beyond the reason it was introduced.
The decision that seems right at the wrong time
Design patterns have an origin context. The GoF didn't create Factory to be used in every class that constructs an object. Coordinator wasn't created to encapsulate every navigation decision in an app with two hundred screens.
What happens in practice is different. An engineer solves a real problem with a pattern. It works. The team adopts it. It becomes a rule. From then on, all new code follows the pattern, even when the problem it solves isn't present.
I've done this myself. At Compass UOL, when I was working on reusable signup and profile-editing modules, there was an implicit pressure to make everything extensible. I built a configuration-by-injection system so that each of the 23 teams could customize the module's behavior without touching the source code.
It worked for half the cases. For the other half, teams needed something the configuration didn't cover, and the solution was to create a subclass or pass a closure that rewrote a good chunk of the logic I tried to encapsulate. The extensibility turned into a second parallel interface, less documented than the first.
The pattern solved the problem for the first five teams. For the other eighteen, it created an obstacle.
The real problem behind the problem
There's a common belief that a well-applied pattern equals well-structured code. That's not true.
Well-structured code is code whose behavior you can trace with effort proportional to the complexity of the problem. If the problem is simple and the tracing is hard, the structure is wrong regardless of the pattern.
What design patterns actually do is organize responsibility. When you use Strategy, you're saying the algorithm varies and the context doesn't. When you use Observer, you're saying multiple consumers need to react to the same event without coupling. When you use Coordinator, you're saying navigation logic doesn't belong in the ViewController.
Each of those statements has a cost. The cost is indirection. You pay indirection in exchange for flexibility or decoupling.
The problem is when you pay the cost without having the need.
Introducing Strategy when the algorithm will never vary means paying for flexibility that doesn't exist. Introducing Coordinator when navigation is linear means paying for decoupling that will never be used. You created a layer of indirection and the team will have to cross that layer every single time they need to understand the flow.
Patterns nobody needs to cross don't exist for the team. They exist against the team.
What actually works in practice
The right question before introducing a pattern isn't "does this pattern solve my problem?". It's "what indirection cost am I accepting, and when will that cost pay off?".
If the cost never pays off because the flexibility is never used, you didn't apply a pattern. You added architectural bureaucracy.
In practice, I've learned to test patterns across three dimensions before adopting them:
Does the variation exist today, or could it exist? If the answer is "maybe in the future," the pattern is probably premature. YAGNI isn't a principle of laziness. It's a principle of indirection cost.
Can someone who wasn't part of the decision understand the flow in under ten minutes? If they can't, the pattern created an entry barrier that will permanently raise the cost of onboarding and maintenance.
Can the pattern be removed if the premise changes? Patterns that create reversible dependencies age well. Patterns that invade data structures or type hierarchies become permanent legacy.
Implementation and the right moment to refactor
In an iOS codebase with multiple teams, like the one I worked on at OLX, the problem of excessive patterns gets amplified. Each team adopts a variation. The Account team's Coordinator works differently from the Reputation team's Coordinator. Both are called Coordinator, but the integration logic between them is ad hoc.
The pattern became a shared vocabulary without shared semantics. Everyone knows the name, nobody knows the contract.
The right moment to refactor isn't when the pattern starts to feel uncomfortable. It's when the maintenance cost exceeds the original benefit. That usually shows up through three signals:
First: new features consistently require changes across multiple layers that were supposed to be independent. Second: new developers need more than half an hour to understand a flow with fewer than ten screens. Third: the pattern has started being worked around by workarounds that keep growing in parallel.
When these signals appear together, the pattern is no longer serving the code. The code is serving the pattern.
Honest trade-offs
Removing an established pattern has a high cost. Especially in codebases with multiple teams and frequent releases. You can't do a refactor that stops the world.
The alternative that works is isolation. You don't remove the Coordinator from the entire app. You stop expanding the pattern and let new features use direct navigation where it makes sense. Over time, the problematic area shrinks through natural attrition.
The risk is temporary inconsistency. Two conventions coexisting in the same codebase. That's uncomfortable, but it's less risky than rewriting in production.
What I would do differently today
I would introduce patterns later. Much later.
Most of the patterns I adopted too early were motivated by anticipating problems that never showed up. And the problems that did show up were different from what I expected, so the pattern didn't cover them anyway.
The exception is patterns that reduce coupling at boundaries that already exist: distinct modules, distinct teams, distinct domains. In those cases, the investment in indirection has a clear return.
For problems within a single domain, especially in new features, I prefer direct, readable code with zero patterns over elegant code that nobody can navigate.
Final reflection
There's an illusion that patterns communicate intent. They do... when the reader knows the context in which they were applied. When the context changes and the pattern stays, what's left is the structure without the reason.
And structure without reason isn't architecture. It's archaeology.
The code that outlives the team isn't the most sophisticated. It's the code any engineer can read, understand, and modify with confidence, even without having been part of any previous decision. No pattern guarantees that automatically. What guarantees it is the indirection cost being lower than the value it delivers.
When the cost exceeds the value, the pattern has become the problem.