How do you refer to the currently logged in user in your code?
The lead point is worth some development.
It is very important to choose good variable names where the "good name" has properties
- accurate (not named sloppily)
- short (as short as possible, without loss of meaning)
- unambiguous (not easy to confuse with something else)
If you get stuck, try to describe the thing in plain English.
Do you want to save the name of the user who is currently logged in? How about currentLoggedInUser ?
In your context, do you care that users are not logged in?
If not, then currentUser will do everything and it will be more concise.
Can anything else be confused?
Nope. We have a winner!
Now you can shorten it further, for example currUser , but you will lose some of the clarity. Remember, the IDE will be there to help you type, so you need to think about what you are losing (clarity) as a trade off of what you get (less keystrokes). This moment can be decided according to personal taste, when you develop for yourself and for yourself, but if you are in a team, it is not easy; choose the version that is easiest to understand in the future.
Think of this ax-wielding maniac who has to maintain your code in five years.
a source to share