I’m not sure who said it recently (I think it was Haacked) but I completely agree: Never Use Bool, or more specifically never user bool as a parameter. It is the most foolish of datatypes and conveys the smallest amount of information possible. Which means that you have to add all the context of what it means to the parameter name which is not visible once your intellisense has faded. I recently came upon this little gem in my code:
Function names have been changed to protect the innocent. but you get the jist. What does those boolean flags mean? I certainly don’t know! And things get even more fun when you need to refactor out one of the parameters or even worst add one in. A far better function call would look like this:
Now, not only is the intention of the function explicit but also you have somewhere to go if you want more options for a parameter. I pretty sure someone covered mentioned this in the past 3-4 months but I think it’s worth re-iterating.
Of coarse it is more verbose and Atwood would probably have me strung up. But what do I care..?