A function with a boolean (or enum) flag parameter that dispatches to different internal behaviors — `setDimension('height', value)` vs `setDimension('width', value)`.
Each flag value becomes its own well-named function; callers say what they mean rather than passing booleans.
Before the refactoring
function setDimension(name, value) {if (name === 'height') { /* ... */ }else if (name === 'width') { /* ... */ }}
After the refactoring
function setHeight(value) { /* ... */ }function setWidth(value) { /* ... */ }
Call sites must remember the flag's meaning; the function's body is a switch the agent reads through to find each branch; new flag values touch one body that handles many concerns.
Two replacement functions with similar bodies introduce duplication — pair this with Extract Function for shared internals.
Call sites read fluently; new variations land as new functions instead of new switch cases.
Splitting flag-dispatched functions whose branches are mostly shared body — produces N functions with N copies of the same body, inverting the original abstraction.