News for hackers. Stuff that matters.
Re:Hall of API shame: Boolean trap (2011) by przemoc on Wednesday August 21, 2013 @06:37PM (#6253765)
Boolean parameter can be useful (for DRY-ness, etc.), but to prevent any misunderstandings, I almost always introduce descriptive constants in such cases:

  const bool SOMETHING = false;
  const bool OTHERTHING = true;
and use them strictly for such parameter.

When there is a default parameter value, sometimes even only one constant can be enough (for non-default variant description).

There are no comments on this comment yet.