Nguyen Le Phong

Designing for the Change You Can Actually See

Every abstraction has a running cost.

Say your team is reviewing the design for a new integration. Twenty minutes in, the discussion is stuck on "what if we switch databases," "what if we go multi-tenant," "what if this turns into a platform." Then someone asks a different question: which parts of this code have actually changed three times in the past year? That one, the room can answer. A pricing rule for one big customer. A report layout finance keeps tweaking. A provider whose response format shifts every few months. One step in the approval flow that keeps moving around.

Engineers compare two simple system sketches on the table and point at the one path where changes keep happening.
The places that have already changed tell you more about where to put flexibility than any guess about the distant future.

That second question is what this post is about. Spend flexibility where change has already shown up, and keep everything else plain until it asks for more.

Flexibility you pay for every day

Teams often overpay for flexibility nobody has needed yet. We add an interface because a future version might want a second implementation, build a plugin point nobody plugs into, or split a module before anything is pushing on it. The motive is good: everyone wants the system to survive change. The bill is real, though.

Martin Fowler splits that bill into four parts in his note on Yagni. Cost of build is the time spent on the presumptive feature. Cost of delay is the value you didn't ship meanwhile. Cost of carry is the extra complexity that makes every other change slower and harder to debug. Cost of repair is what you pay when the future turns out different from your guess. Carry is the sneaky one. You pay it on every unrelated change, for as long as the code lives, even if your guess was right.

Sandi Metz shows how these guesses go bad over time in The Wrong Abstraction. Someone extracts shared code. A new requirement almost fits, so the next person adds a parameter and a conditional. Then the next one does the same. Eventually, as she puts it, "what was once a universal abstraction now behaves differently for different cases." Her conclusion is blunt: "duplication is far cheaper than the wrong abstraction."

An old idea, with better evidence

Designing around change is older than most of our stacks. In 1972, David Parnas suggested that you decompose a system by starting "with a list of difficult design decisions or design decisions which are likely to change," then design each module "to hide such a decision from the others" (On the Criteria To Be Used in Decomposing Systems into Modules). More than fifty years later, it's still one of the best descriptions of a good module boundary.

The tricky word is "likely." Parnas had to reason about it from the problem alone. A product team usually has something better: the history of its own code. You don't need to guess which decisions are likely to change when version control can show you which ones already did.

Find the change you can actually see

Start with the git log. This counts how many commits touched each file over the past year:

git log --since="12 months ago" --format= --name-only \
  | grep -v '^$' | sort | uniq -c | sort -rn | head -20

The top of that list is rarely a surprise, but seeing it written down changes the conversation. Adam Tornhill calls the overlap of frequent change and complex code a hotspot, and uses it to decide where refactoring is worth the effort (Code as a Crime Scene). He also looks at modules that keep changing in the same commit, which he calls logical coupling. If the pricing module and the invoice template always change together, the boundary between them is probably in the wrong place.

Commit counts are a rough signal, so read them with some care. On many repos the top spots go to generated files, lockfiles or indexes that change on every build. Read the top 20 with the team and keep the ones where the change came from the business: a new partner, a new rule, a new report.

Then add what the log can't show yet. "A second payment provider is signed for Q3" counts as visible change too, as long as someone can point to the contract or the ticket.

Where flexibility pays, with examples

Once the change is visible, most design calls get much easier. A few that come up a lot:

What you can seeWhat it suggests
Three providers send different status names for the same thing.One adapter per provider, each mapping to your own status type. Ports and Adapters fits well here.
Pricing rules change every few weeks, payment collection hasn't changed in a year.Give pricing a clear module of its own, maybe driven by data. Keep the payment code plain.
UI copy changes weekly, the order state machine almost never.Move copy into content or config. Keep the state machine in code, with good tests.
One provider, and no second one on the roadmap.One small module with a clear name. Skip the plugin system.
"What if we go multi-tenant?" with no customer asking for it.A short decision note with the trigger that would make it real. Build nothing yet.

The one-provider row deserves a closer look. A thin wrapper can still help, because it keeps the vendor's types from spreading through the codebase. Keep it small: one file, named for what it does for you, no factory and no registry. If a second provider does show up, you'll extend it with real requirements in hand, which beats extending it from a guess.

Write the worry down

When a change is only a worry, give it five minutes in a decision note: what you're worried about, which signal would make it real (a signed partner, a second customer asking, the same edit for the third time), and what you'd build then. The note costs five minutes once. An abstraction costs every future reader.

Plain code in a stable area is good design

A plain implementation in a part of the system that rarely changes is a good choice. A flexible one wrapped around a guess makes the code harder to read for something that may never happen. The skill is matching design effort to the pressure each part is under, which means some parts stay plain on purpose.

Fowler adds a condition worth repeating: Yagni "is only a viable strategy if the code is easy to change." Waiting on an abstraction only works if you can add it cheaply later, and that takes tests you trust and a habit of small, frequent changes. Without those, in his words, "yagni turns from a beneficial practice into a curse." So the fair trade is this: skip the speculative layer, and put that time into tests and refactoring that make the real layer cheap when it's needed.

Look again every few months

The picture moves. A stable area can start churning when the business enters a new market. A feared change can turn out to be irrelevant. Rerun the git log every quarter or so, compare it with the last list, and reread your old decision notes. Some triggers will have fired. Others can be deleted. Treating architecture as a series of small adjustments as evidence comes in is also a lot less stressful than trying to predict everything on day one. For more on drawing boundaries this way, see Choosing Boring Boundaries on Purpose.

Try this week

  • Run the git log command on your main repo and go through the top 20 files with your team.
  • For each one, ask whether it changed because of the business or because of tooling churn.
  • Pick one interface that has a single implementation and ask what change it protects against, and where that change has shown up.
  • Turn one "what if" from your last design review into a decision note with a clear trigger.
  • The next time someone proposes a new layer, ask to see the change it's protecting you from.
What did you think?

Frequently asked questions

What does designing for visible change mean?
It means adding flexibility where change has already happened or is clearly on the way, such as a rule that keeps getting edited or a second provider that's already signed. Parts of the system that rarely change stay plain until real pressure shows up.
How can I find which parts of my code change most often?
Count commits per file in version control, for example with git log over the past twelve months. Then filter out generated files and tooling churn, and look at the files that change because of business needs. Adam Tornhill calls the overlap of frequent change and complex code a hotspot.
Isn't it risky to skip abstractions I might need later?
It's only safe if the code is easy to change later. Martin Fowler notes that Yagni works only with practices like self-testing code and continuous delivery. Skip the speculative layer, invest in tests and refactoring, and add the abstraction when a real requirement arrives.
What should I do with a change that is only a worry?
Write a short decision note: what you're worried about, which signal would make it real, and what you'd build then. Revisit those notes every few months. A note costs minutes, while an unused abstraction costs every future reader.