Devenet Devenet

Stop naming your variables “flag”: the art of boolean prefixes

https://thatamazingprogrammer.com/posts/stop-naming-your-variables-flag-the-art-of-boolean-prefixes/

1. IS: Identity and State • Use is when describing what something is right now. It usually pairs with an adjective.
   isActive, isDeleted, isEmpty

2. HAS: Containment and Features • Use has when describing ownership or inclusion. It pairs with a noun.
   hasAccess, hasChildren, hasValidationErrors

3. CAN: Capability • Use can to check permissions or potential actions.
   canEdit, canDelete, canRetry

4. SHOULD: Intent • Use should for business rules or decisions the system needs to make. This separates “what we can do” from “what we want to do.”
   shouldRetry, shouldCacheResponse