I'm struggeling with the prefixes of my Booleans between Is- and Has-.
Because sometimes Has- make more sens than Is-
Sampe:
bool IsPrintable
bool IsChecked
bool HasDocument
bool HasPermission
so whats your opinion about that?
I'm struggeling with the prefixes of my Booleans between Is- and Has-.
Because sometimes Has- make more sens than Is-
Sampe:
bool IsPrintable
bool IsChecked
bool HasDocument
bool HasPermission
so whats your opinion about that?
Use both. It makes your code much more readable:
if (IsPrintable) Print()
if (HasDocument) Documents[0].Name = 'New Doc'
Etc.
You could always use _p
Document_p
Printable_p
This derives from an old Lisp convention. "P" stands for predicate, making it basically a form of Hungarian notation. This makes _p
always precisely true, versus always using Is
or Has
, which would be misleading at best.
But seriously: Follow @Ryan's suggestion. Use both.