As noted by in the comments by @benjamin-gruenbaum this is called the Boolean trap:
Say I have a function like this
UpdateRow(var item, bool externalCall);
and in my controller, that value for externalCall
will always be TRUE. What is the best way to call this function? I usually write
UpdateRow(item, true);
But I ask my self, should I declare a boolean, just to indicate what that 'true' value stands for? You can know that by looking the declaration of the function, but it's obviously faster and clearer if you just saw something like
bool externalCall = true;
UpdateRow(item, externalCall);
PD: Not sure if this question really fits here, if it doesn't, where could I get more info about this?
PD2: I didn't tag any language 'cause I thought it was a very generic problem. Anyway, I work with c# and the accepted answer works for c#
data CallType = ExternalCall | InternalCall
in haskell for example.