A function whose body holds many shared locals across conceptually distinct sub-steps; the agent extracting any step must thread temps through helper parameters.
Each sub-step becomes a named method on the command object; sub-step methods share state through fields the agent reads from one class file, and tests target one method at a time without simulating the full function body.
Before the refactoring
function score(candidate) {let total = candidate.experience * 10;if (candidate.hasCertifications) total += 25;total -= candidate.gaps * 5;total += candidate.referrals * 8;return total;}
After the refactoring
class Scorer {constructor(candidate) { this.candidate = candidate; }execute() {return this.base() + this.bonus() - this.penalty();}base() { return this.candidate.experience * 10 + (this.candidate.hasCertifications ? 25 : 0); }bonus() { return this.candidate.referrals * 8; }penalty() { return this.candidate.gaps * 5; }}new Scorer(candidate).execute();
Every step the agent wants to extract drags shared state through parameter lists; the function's algorithm shape resists decomposition.
Command ceremony (constructor + execute + named private methods) is overhead for functions without genuine multi-step state; the agent now navigates a class where one function used to suffice.
Each sub-step becomes a named method on the command; the agent extracts and tests them in pieces without rewiring shared state.
Promoting every long function to a command — including ones with no genuine shared state — adds class ceremony the agent must navigate without gaining any decomposition advantage.