It depends, but I would choose the second ( nodeCount ). If your project has a specific agreement, you must follow this agreement or discuss the agreement with your team. It may also depend on the area of ββyour application. It may be okay to follow generally accepted notations in your domain.
There are several rules that could help you make these decisions.
If something can be misunderstood, someone will be misunderstood. Eliminate the possibility of misunderstanding. The probability of misunderstanding is much less in the second sentence of nodeCount . Anyone who speaks English should understand this. The first sentence, on the other hand, depends on understanding the n prefix.
Write the best noun description at the end. Is this more of a count or more of a collection of nodes ? For further use of the variable, it is important to understand that this is a count (number), and then it is counted. Therefore nNodes worse than nodeCount .
Follow basic programming principles such as KISS (keep it simple, stupid) or "Don't write smart code. Write" embarrassingly obvious "code. Ask your mother if she understands your code. If so, you wrote good code :)
Markus hetich
source share