In Ruby, predicate methods (methods that return boolean values) should end with a question mark to indicate their boolean nature. Using both the
"is_" prefix and the "?" suffix creates redundancy that violates Ruby naming conventions.
The question mark suffix already clearly communicates that the method returns a boolean value. Adding "is_" makes the method name unnecessarily
verbose and goes against established Ruby idioms. This redundancy can make code less readable and harder to maintain.
Ruby’s naming conventions emphasize clarity and conciseness. Method names like empty?
, valid?
, and present?
are more idiomatic than is_empty?
, is_valid?
, and is_present?
.
What is the potential impact?
Using redundant "is_" prefixes in predicate methods reduces code readability and violates Ruby naming conventions. While this doesn’t cause runtime
errors, it makes the codebase less idiomatic and can confuse developers who expect standard Ruby naming patterns.
This pattern can also make method names unnecessarily long, reducing code clarity and making it harder to follow established Ruby style guides.