tags:

views:

280

answers:

7

Hey Stack overflow

what's better? nNodes or nodeCount

+7  A: 

This is simply a style issue. I prefer nodeCount because I find it clearer. nNodes is more similar to Hungarian notation, but doesn't say it's a count variable.

Hosam Aly
If your code convention is that "nSomething" always stands for "number of somethings", you don't need to say again that it's a count variable.
ShreevatsaR
Yes @ShreevatsaR, I agree with you. But if there is no convention (yet) then nodeCount seems clearer (to me).
Hosam Aly
+2  A: 

The second, since it reads properly.

paxdiablo
+3  A: 

Whichever is consistent with the rest of your code base / style guide / dev team.

Brian
+2  A: 

It really depends on the accepted naming conventions of whichever language you are using, but nodeCount is more readable. If you are using Java, you can use the Java Naming Conventions guide.

William Brendel
+1  A: 

The first one in C++, the second one in C#/Java.

Though this is really very subjective question and should be answered by your team/company guidelines.

Franci Penov
+2  A: 

numNodes ?

Niyaz
A: 

Avoid putting "count" into variable names, too easy to get an obscene typing error.

quant_dev
nodeCunt? haha thats funny! not
I don't think I've made that particular typing error, but I have gotten the "public" keyword wrong too many times.
dan04