Comparison
Boolean trapvsLong parameter list
Boolean trap
the call reads createUser(name, true, false) and you have to open the definition to find out what either means.
A boolean parameter that makes a call site unreadable and usually indicates a function doing two different things. The immediate fix is a named constant or an enum; the better one is often two functions with names, since the boolean is generally selecting between two behaviours rather than configuring one. It is the most frequently cited example of connascence of position and meaning at once.
Full entry →Long parameter list
the method takes nine arguments, four of them are the same type, and you got two of them the wrong way round.
A signature with enough parameters that call sites become positional puzzles and mistakes stop being caught by types. It is usually a symptom rather than the problem: several parameters that always travel together are a missing object, and a flag among them is a missing second method. A builder or a parameter object addresses the readability; a smaller responsibility addresses the cause.
Full entry →