A method that switches between abstraction levels mid-body — control statements, low-level mutations, validation, and high-level orchestration interleaved. Readers have to mentally separate the algorithm from the bookkeeping every time they open the file. The reader's comprehension cost rises because every read reconstructs the method's outline from scratch.
A method whose body the agent traces line-by-line to understand the algorithm; the high-level shape is obscured by interleaved details. Verifying behavior preservation requires re-reading the entire span on every edit. The agent's context-window load carries the unstructured body, and the reasoning step count rises as the agent re-derives the structure on each read.
The top of the method reads as a numbered outline of intention-revealing steps at one level of detail; each step's how-it-works lives in a named helper. Readers verify the algorithm at the top level and drill into helpers only when the named step's body is the point of interest, supporting separation of concerns between orchestration and mechanism.
The method reads as a sequence of named operations the agent verifies against without re-deriving the algorithm. Each helper is small enough to reason about in a single reasoning step. The agent's context window holds the orchestrator and the relevant helper; the reasoning-step cost of any edit drops because the relevant unit is named.
Before the refactoring
function add(item, quantity) {if (this.readOnly) throw new Error('list is read-only');const existing = this.items.find(line => line.product.id === item.id);if (existing) {existing.quantity += quantity;} else {this.items.push({ product: item, quantity });this.items.sort((a, b) => a.product.id - b.product.id);}this.recalculateTotal();}
After the refactoring
function add(item, quantity) {assertWritable(this);const existing = findLineFor(this.items, item);if (existing) {increaseQuantity(existing, quantity);} else {insertNewLine(this.items, item, quantity);}this.recalculateTotal();}
Every reader pays the outline-extraction cost on every visit. Small edits to one step force the reader to hold all the others in working memory; the method becomes a churn magnet that touches unrelated changes in the same diff. The team's verification cost compounds across reviewers who must re-derive the method's structure each time.
Every edit re-loads the full method body to confirm behavior preservation. Chained orchestration changes compound context cost; reasoning about cross-step invariants gets harder as the method grows. The agent's verification-surface cost multiplies with body length — verifying any single change requires scanning every other statement to confirm it didn't shift, and retrieval cost on chained edits compounds.
Helper methods can scatter logic that was once readable as a single span; over-decomposition produces a fan-out of tiny methods where the actual computation is buried three levels deep. The team's maintenance cost can rise rather than drop if the helpers don't carry domain meaning, because every helper is one more name the reader must look up.
Each helper inflates the agent's context-window load by one definition the next reasoning step must load. Over-decomposing fragments a single procedure across many files. The agent's completeness-check cost rises during the decomposition itself — every reference to the body must be confirmed to route through the new helper rather than continuing to inline what's left.
The method body becomes the algorithm in domain language; details live in helpers whose names tell the reader what they do. Editing one concern stays local to the matching helper. The team's enhancement cost drops because adding a new step is one new helper rather than another interleaved block in an already-cluttered body.
The composed method captures the algorithm as a list of named steps the agent reads at one indent; each helper has one signature and one body the agent verifies independently, and edits to one step do not need the others loaded. The agent's token cost per edit drops because the relevant unit is the helper, not the parent.
Compose every method this way and the workflow becomes a forest of one-liners that can no longer be read linearly — the named steps become a directory listing instead of a procedure. The fan-out adds accidental complexity to the call graph; readers carry the cognitive load of jumping between trivial helpers to reconstruct the original procedure.
A deeply-nested hierarchy of helpers where the agent must chase multiple definitions to understand a single original method — context cost multiplies and cross-helper invariants vanish from view. The agent's retrieval cost across the call graph rises faster than the per-helper context-window load drops; tiny helpers cost more to assemble than to inline.