Many naming conventions recommend that methods returning a boolean (also called predicate methods) should be named after a question. My question is: don't they really mean the methods should be named after an assertion?
The difference may be subtle, but you end up with different names in some cases:
- question: is_pixel_transparent(...)
- assertion: pixel_is_transparent(...)
Sometimes, this makes no difference and the phrasing is the same:
- question: end_of_file(...)
- assertion: end_of_file(...)
Besides, it seems like most of the time, what people call "questions" are actually assertions.
- key_exists(...) --> this is not a question, this is an assertion.
Example usage: if (key_exists(...)) ... - array_contains_element(...) --> this is not a question, this is an assertion.
Example usage: if (array_contains_element(...)) ...
So, to restate the question, is everyone meaning assertion when they say question?