Try to avoid having BOOL function parameters

If you’re making an object model or library interface of any kind, please make sure to keep this in mind.  It’s very difficult to get this one wrong, unfortunately, because when you’re designing the object model (or adding the bool param), the meaning is blatantly obvious in your own head. It can be difficult to remember that the consumers of your API won’t have the same mental mindset you do when you’re designing it, even if that seems obvious when stated as such.

Generally speaking, I believe that you should try to avoid giving functions a boolean parameter (BOOL, bool, etc.) unless the meaning of that boolean parameter is blatantly obvious.

Source: The Old New Thing : Try to avoid having BOOL function parameters

Advertisements