Compare
Symptom
Human

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 rises because every read reconstructs the method's outline from scratch.

Agent

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 carries the unstructured body, and the count rises as the agent re-derives the structure on each read.

Goal
Human

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 between orchestration and mechanism.

Agent

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 holds the orchestrator and the relevant helper; the 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();
}
Example source: Illustrative example written for this site, not a quotation from the book. The pattern itself is Joshua Kerievsky's, from Refactoring to Patterns (Addison-Wesley, 2004), see the chapter on Compose Method.
Pressure
Human

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 compounds across reviewers who must re-derive the method's structure each time.

Agent

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 multiplies with body length — verifying any single change requires scanning every other statement to confirm it didn't shift, and on chained edits compounds.

Tradeoff
Human

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 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.

Agent

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 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.

Relief
Human

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 drops because adding a new step is one new helper rather than another interleaved block in an already-cluttered body.

Agent

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 per edit drops because the relevant unit is the helper, not the parent.

Trap
Human

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 to the call graph; readers carry the of jumping between trivial helpers to reconstruct the original procedure.

Agent

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.