|
|
| Do you know where your variables are? | |
| PerlMonks |
Re: camelCase vs snake_caseby greengaroo (Friar) |
| on Aug 29, 2012 at 18:36 UTC ( #990529=note: print w/ replies, xml ) | Need Help?? |
|
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.
-- greengaroo
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||