4 ms·
This is by far the number one API design anti-pattern in terms of how widespread it is. It's like bad kerning: once you've seen it, it's everywhere, and nobody
by h2s 13y ago
This is by far the number one API design anti-pattern in terms of how widespread it is. It's like bad kerning: once you've seen it, it's everywhere, and nobody seems to notice.
It usually results from writing code with a short-sighted focus on achieving some bespoke functionality in the least possible time. Somebody wants to disable a piece of behaviour in a function, they know where the code is, they wrap it in an if statement and throw another optional boolean parameter onto the pile.
It's symptomatic of functions, methods or subroutines that are too long. Functions should do one thing at one level of abstraction, and the very possibility of a boolean parameter means that your function is doing at least two things.