The is pattern for queries

One way to partition functionality within classes is to separate command (mutate) actions from query (inspect) actions.

Query actions have a number of well-established naming conventions. Let’s examine the “is_whatever?” pattern.

Consider a car, a spider and word (Ruby syntax):

car.is_vehicle?       # true
spider.is_insect?     # false, spiders are arachnids
word.is_abbreviation? # 4. WTF!?

The convention is that any function or method prefixed with “is” queries for a boolean value. Returning anything other than true or false will induce cognitive dissonance in the reader.

The reader might well be you, next year.