I'm looking at a function called:
WhetherAddFloor(leg) -> bool
and when I see code like:
if(WhetherAddFloor(l)) ...
it smells odd and am wonder if something like:
CheckAddFloorNeeded(leg) -> bool
wouldn't be better? Thoughts?
In languages where question marks are allowed in function names the style is to append one to the end if the function returns boolean:
FloorNeeded?(leg)
But where that isn't syntactically possible the convention is to use the word 'is' at the beginning:
isFloorNeeded(leg)
It's generally easy to read and understand and it seems like it'll fit your situation.
WhetherAddFloor()
sounds as quite an unfortunate choice to me.
CheckAddFloorNeeded()
is better, if the function has a substantial amount of work to do, and you would like to advertise that fact to those who use the interface.
IsFloorNeeded()
is also good, if the function does not have a substantial amount of work to do, (say, it is just an accessor to a previously computed member,) or if you want to keep this little bit of information secret from those using the interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With