Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: camelCase vs snake_case

by greengaroo (Hermit)
on Aug 29, 2012 at 18:36 UTC ( #990529=note: print w/replies, xml ) Need Help??


in reply to camelCase vs snake_case

Funny enough, I changed ways of doing things several times during my career. I remember that I use to make most of my variables CamelCase in the beginning. After reading stuff and meeting other developers and seeing other people's code, I gradually changed.

So now, for variables, I don't use uppercase because Perl itself uses it for internal variables, such as @ARGV or %ENV. You never know, maybe you can stumble on a pre-defined variable by mistake! So CamelCase or snake_case? Well I choose snake_case because in my experience, I often had errors from mistyping one of the letters, for example: $staticAlert instead of $StaticAlert. I think snake_case is easier to read too. I use the same rule for methods or subroutine names.

For modules, I use CamelCase. I don't like modules in lowercase or snake_case because when you have something like this: My::NameSpace::something_to_do, how can you know at first glance if something_to_do is another module or a subroutine of NameSpace? So I stick to CamelCase for modules and that works well for me.

There are no stupid questions, but there are a lot of inquisitive idiots.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990529]
help
Chatterbox?
[james28909]: hi, im james, and i am bat shit crazy. xD
[james28909]: crazy or genius....
[Eily]: hi bat shit crazy, I'm eily
[LanX]: hello James
[james28909]: lol
[james28909]: i honestly didnt thin kanyone was going to respond, or was even paying attention :l
[Eily]: well if you say something like that someone has to pay attention by law
[Eily]: Murphy's law to be precise

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2017-12-13 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (373 votes). Check out past polls.

    Notices?