Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

CamelCase really that bad?

by gzartman (Novice)
on Aug 23, 2016 at 01:05 UTC ( #1170200=perlquestion: print w/replies, xml ) Need Help??

gzartman has asked for the wisdom of the Perl Monks concerning the following question:

So, I started a pretty big project and decided to use CamelCase for vars and methods because some other classes I was using used it, and quite honestly I like it better. :)

However, now I'm starting to question me decision. I'm starting to wonder if I should have followed the more traditional approach as detailed in the Camel. I'm still at a place I can convert over (with only moderate pain).

I'm curious what you guys think? Is going with camelCase for vars and methods really that big of a deal?

Replies are listed 'Best First'.
Re: CamelCase really that bad?
by Athanasius (Archbishop) on Aug 23, 2016 at 02:55 UTC
Re: CamelCase really that bad?
by stevieb (Canon) on Aug 23, 2016 at 13:23 UTC

    I use snake_case when I write Perl and Python no matter what other libraries that I import are using. In C/C++/C#, I use snake case when the code is wholely my own, but if I'm using calls from other libraries, I stick with whatever it uses.

    The Perl 6 folk use another convention that I wasn't familiar with until I took it up. Lower-case hyphenated (some-var). Some argue that it's called "lisp-case".

Re: CamelCase really that bad?
by Anonymous Monk on Aug 23, 2016 at 01:11 UTC

    What do you mean by CamelCase, can you be more specific?

    camelCase is terrible for package names

    CamelCase is terrible for method names

    camelCase is fine for method names, its the standard camel case

    CamelCase is fine for package/module names, its the standard

    ...

    See what I mean?

      I'm using:

      Package name = CamelCase
      Method name = camelCase
      Var name = camelCase (prefer single word if possible)

      Sounds like I'm fine.
      I think "the standard" is a bit too strong of a statement. Package names are supposed to be capitalized, so yes CamelCase is something generally expected, but as for method names I don't see how camelCase is better than CamelCase, both are used, although snake_case is something I see much more often in Perl code.

        I think "the standard" is a bit too strong of a statement.

        You're over thinking it :)

        Package names are supposed to be capitalized, so yes CamelCase is something generally expected,

        Also know as the standard convention

        but as for method names I don't see how camelCase is better than CamelCase, both are used, although snake_case is something I see much more often in Perl code.

        Do more research :)

        You see one used more than the other, so one is the standard camelCase

        https://en.wikipedia.org/wiki/Naming_convention_%28programming%29

Re: CamelCase really that bad?
by duyet (Friar) on Aug 24, 2016 at 13:25 UTC
    What ever cases you are using it is fine if you're (and your team if applicable) happy with it. But don't mix them. Write down as some sort of coding standard and stick with it. Especially for later when there is/are new member(s) added to the team. Personally. i like snake_case and use it as mentioned in camelCase vs snake_case
Re: CamelCase really that bad?
by RonW (Parson) on Aug 24, 2016 at 22:55 UTC

    I prefer camelCase as much as possible. Sometimes, external dependencies result in mixing camel and snake casing.

    Our coding standards encourage camelCase, even applying it to acronyms, but some people just can't parse camelCase acronyms, demanding we snake acronyms: RMS_MVS instead of rmsMvs.

Re: CamelCase really that bad?
by Plankton (Vicar) on Aug 29, 2016 at 06:26 UTC
    It shouldn't matter.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1170200]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-10-25 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?