Deletion probe before abstraction
Challenge an abstraction by predicting where complexity would go if it vanished.
These examples and illustrative results are independently authored teaching materials, not measured model results.
Use case
Decide whether to retain a parser wrapper with its implementation and two callers available. In teaching case A, readConfig only forwards to JSON.parse. In case B, it also validates required fields and sorts entries by ID, rules both callers need. Compare deletion consequences before editing code.
Mechanism
List what callers must know and what the wrapper hides. Imagine removal and describe what each caller would add. A pure forwarding layer may collapse; duplicated validation, ordering or error handling indicates work centralized by the wrapper. Inspect compatibility and real callers before recommending retention, simplification or removal.
Bad example
Review both readConfig cases above. More layers mean cleaner architecture, so keep both wrappers regardless of the responsibility they hide.
Good example
Perform a deletion probe for cases A and B without changing code. List the parsing, validation, ordering and error handling each caller would need after removing readConfig. If deletion only eliminates forwarding, propose collapsing it. If it duplicates shared rules across callers, explain the retained responsibility and interface. Cite actual implementation and call sites, then check compatibility before suggesting a change.
Why the change matters
Layer count does not establish an abstraction’s value. The probe asks whether complexity disappears or moves: disappearance suggests redundant forwarding; redistribution shows work the module performs for callers. Recommendations become traceable to responsibilities.
Observable expectation
An illustrative comparison shows A callers directly using JSON.parse without losing extra rules, while B callers each acquire validation and sorting.
Verify real call-site coverage and hidden error/ordering contracts. ‘The class is short’ or ‘There are many layers’, without those checks or compatibility, is insufficient evidence for deletion.
Limits
A probe is analysis, not authorization to remove code. Even pure forwarding may preserve a public interface or migration adapter. Function length does not measure interface depth. The source deletion test has been located; the incorrect earlier line range is tracked separately.