camelcase or underscore? What to use?

Questions about programming languages and debugging
Post Reply
User avatar
z3r0aCc3Ss
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 700
Joined: 23 Jun 2009, 16:00
14
Contact:

camelcase or underscore? What to use?

Post by z3r0aCc3Ss »

Over this question, I almost had fight with my senior. I have a habit of using underscores, and according to my senior, it's a bad practice. He told me to use camelcasing.
Is there any performance difference between two of them? If I see all the jQuery libraries, they use camelcasing. Even some of the PHP libraries are camelcased.
I prefer camelcasing.

Please share your opinions.
Beta tester for major RATs, all kinds of stealers and keyloggers.
Learning NMAP

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: camelcase or underscore? What to use?

Post by bad_brain »

there is no performance difference, because a character is a character and every character is 8bit (in ASCII).....so a _ has no overhead compared to a B for example.
if you write code for you own you can use what you feel like and what works best for you (I am an underscore guy), but if you do an public open source release for example it would be better to stick what is labeled as "common practice".
Image

User avatar
z3r0aCc3Ss
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 700
Joined: 23 Jun 2009, 16:00
14
Contact:

Re: camelcase or underscore? What to use?

Post by z3r0aCc3Ss »

That's a nice answer.
But what if my code with underscores is of 5000 lines, and 100 KB and the same code with camelcasing is of 4300 lines and 90 KB.
Which one will run faster? Or is there any other difference?
Beta tester for major RATs, all kinds of stealers and keyloggers.
Learning NMAP

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: camelcase or underscore? What to use?

Post by bad_brain »

well, with such complex scripts the performance based on the sheer size of a script is neglectable imo....at least as long as not ALL the rest is 100% optimized.
what matters way more are the actual functions then, like database queries, file reads and writes, etc.
IF everything is 100% optimized and the scripts are also 100% the same, except for the sizes caused by the use of underscores or not, then of course the smaller script will be faster simply because of the read time....but that would be microseconds and only of interest is an environment with an enormous visitor rate.
Image

User avatar
ph0bYx
Staff Member
Staff Member
Posts: 2039
Joined: 22 Sep 2008, 16:00
15
Contact:

Re: camelcase or underscore? What to use?

Post by ph0bYx »

When in doubt follow Google's style guide(s): https://github.com/google/styleguide" onclick="window.open(this.href);return false;

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: camelcase or underscore? What to use?

Post by ayu »

I use underscore a lot these days when coding, and camel when creating pass phrases :P
"The best place to hide a tree, is in a forest"

Post Reply