Trying to find the name for that API design anti pattern where a function has overloaded behaviors based on the argument type or value, but the distinction is riddled with error-prone ambiguities. Example: you can pass a list of values or just the value (but don't try to pass a value that's a list that way); you can pass any string, except when it's "default", something special happens (hopefully that never occurs in real data). Any pointers?

@christiankothe I hate that so much. A strcmp-like function with a bool parameter for case sensitivity is like nails on chalkboard for me. Or a function where invalid parameters (e.g. a null pointer) "helpfully" turns the function's behavior into doing nothing: return early, perhaps calling a default constructor if there's a return value. It's hard to believe I've seen people defend the latter kind of programming style by calling it defensive.

Follow

@pervognsen Yeah the latter one is really problematic. I think all of these patterns should have searing painful names that you can call out to discourage someone from practicing that style. Like, oh what you're doing there is False Overloading and it's _really_ bad, go read about it.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.