intermediate 2 min answer

A reviewer rejects a change for violating the single responsibility principle. When is that a substantive objection and when is it cargo cult?

supabasesolidprinciplesreviewjudgement
Show the full answer Hide the answer

When it is substantive

When the responsibilities change for different reasons, at different times, driven by different stakeholders. That is the operative meaning of the principle: a class should have one reason to change.

The substantive version of the objection names the reasons: "this handles both the tax calculation, which changes when a jurisdiction changes, and the email template, which changes when marketing runs an experiment — so a copy change requires deploying the code that computes money."

That is an argument with evidence and a consequence.

When it is cargo cult

When it means "this class is long", or "this does more than one thing" in a purely descriptive sense. Nearly every useful class does more than one thing, and length is a weak proxy for anything.

The tell is that the objection cannot name the two different reasons to change, or that the proposed split produces classes that always change together — which is the same responsibility distributed across more files, with an interface in between and no benefit.

The general pattern with all such principles

They are heuristics derived from a real cost, and they are frequently applied without reference to the cost. The interface segregation principle addresses consumers being forced to depend on methods they do not use — a real problem when it happens and not present in most interfaces. Dependency inversion addresses replaceability — worth paying for at boundaries where replacement is plausible and pure overhead at boundaries where it is not.

The question to ask in review

"What does this cost us, concretely, and when?" A principle-based objection that can answer is a design argument. One that cannot is an aesthetic preference presented as a rule, and the appropriate response is to ask the question rather than to comply or to argue.

The same question improves the reviewer's own thinking, which is why it is better than dismissing the objection.