A function with a flag parameter that dispatches to different internal behaviors; the agent must trace the flag's value through the body to verify which branch any call exercises.
Each flag value becomes a named function; the agent reads call sites as direct invocations of the intended behavior.
Before the refactoring
function setDimension(name, value) {if (name === 'height') { /* ... */ }else if (name === 'width') { /* ... */ }}
After the refactoring
function setHeight(value) { /* ... */ }function setWidth(value) { /* ... */ }
The agent must reason about flag values at every call site; the function's body conflates multiple concerns the agent must mentally split.
If the branches share substantial body, splitting produces duplication the agent must keep in sync; pair this with Extract Function for shared internals.
Each variant becomes its own function with one signature; call sites name the intent directly, and the agent does not track a flag value through the function body to predict which branch runs.
Splitting flag-dispatched functions without extracting shared body creates N copies of the same logic the agent must keep in sync — the cure becomes the duplication smell.