When naming a boolean, or a function returning a boolean it’s usual to prefix with ‘is’ e.g.
- isPointerNull
- isShapeSquare
What about when refering to multiple items, should it be:
- arePointersNull or isPointersNull
- areShapesNull or isShapesNull
I can see arguments for both; is offers consistency and perhaps slightly better readability, are makes the code read in a more natural way.
Any opinions?
Firstly,
isPointersNullis just ugly. Don’t do that.I typically go with
anyorall, asarecan be ambiguous. Does it mean “there are null pointers” or “the pointers are all null”?anyPointersNullandallPointersNullclear that up, IMO.