Q4 · How do you avoid accidental complexity when scaling a system?
Back to 24 Architecture Questions.
The question is not “write simple code”. The axis it turns on: which complexity is essential to the requirement, and which was introduced by the last fix. Essential complexity is the problem’s own: consistency, scale targets, availability. Accidental complexity is what the system accumulated while chasing incidents. Scaling rarely adds essential complexity after the requirements settle; it mostly adds accidental complexity, one point fix at a time.
What the answer should contain
Name the essential set first. List what the requirements genuinely demand: the scale target, the consistency level, the availability number. Every mechanism beyond that list is accidental by definition. You cannot refuse accidental complexity you have not separated from the essential kind.
Fix the class, not the instance. A point fix patches one occurrence and leaves the class armed for the next incident. The question for every hotfix review: does this remove the failure mode, or only this sighting of it?
Judge a fix by what it adds. A fix that deletes code, a branch, or a failure mode is paying rent. A fix that adds a special case, a flag, or a second code path is taking on a mechanism with interaction costs. The cost is not its fifty lines; it is that fix N must understand N-1 mechanisms before it.
Delete more than you add. When a fix obsoletes an older mechanism, delete the older one in the same quarter. A mechanism nobody is paid to remove never leaves on its own; that is the ratchet in one sentence.
Prefer boring, standard mechanisms. Cache, queue, read replica, known library. Their interaction behavior is documented and predictable. Bespoke mechanisms carry undocumented interactions, which is exactly what the loop feeds on.
Measure accidental complexity directly. Feature flags older than a quarter with no owner, branches in hot paths, config knobs nobody can explain. If it is not measured, the ratchet is invisible until the onboarding doc gives up.
Ideas worth mentioning out loud
- “Requirements add essential complexity one at a time; fixes add mechanisms one at a time. The gap between the two lists is your accidental complexity.”
- The ratchet turns one way unless someone is scheduled to turn it back: book deletion like a feature, not like an intention.
- Essential vs accidental is a claim about your requirements, not a property of the code. The same queue can be either, depending on whether the requirement asked for it.
Follow-ups to expect
- Isn’t a point fix sometimes the only option under incident pressure? Yes. The discipline is expiry: the fix carries a review date, and the review asks which class it belongs to.
- How do you spot it in code review? A change whose only job is to make another change work is accidental; the smell is a fix with a fix.
- Doesn’t real scale demand real mechanisms? It demands some: sharding, replication, backpressure. Accidental is the third queue standing next to the two the requirements actually asked for.
Red flags in an answer
- The same spot patched repeatedly (“we fixed this in March too”).
- Flags older than a quarter with no owner.
- Mechanisms whose only documentation is the postmortem that introduced them.
- “We will clean it up later”, with no later on the calendar.
Sources
- No Silver Bullet, Fred Brooks, 1986: the origin of the essential versus accidental distinction this answer turns on. Brooks’ accidental complexity was about tooling; ours also arrives as shipped point fixes, which is the ratchet the figure draws.
- A Philosophy of Software Design, John Ousterhout: complexity arrives incrementally, one change at a time, and working code not being enough is the book’s core argument for the deletion discipline.
- Simple Made Easy, Rich Hickey: the complect argument. A new mechanism interacts with every previous one because it weaves them together, which is why the ratchet turns only one way.