jargon

Comparison

Boolean trapvsConnascence

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 →

Connascence

two pieces of code have to change together, and you can say precisely what kind of agreement binds them.

A vocabulary for grading coupling rather than just naming it: two components are connascent if changing one requires changing the other, and the kinds are ranked from weak — they agree on a name — to strong — they agree on the order of two operations or on a magic value. It is more useful than 'this is coupled' because it says which coupling to attack first, and it gives boolean arguments, positional parameters and timing dependencies a shared explanation. It is a favourite of conference talks and worth knowing for exactly that reason.

Full entry →

Related comparisons