View Poll Results: Which?

Voters
38. You may not vote on this poll
  • camelCase (lower or upper)

    22 57.89%
  • underscores

    16 42.11%
Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32

Thread: greatest dilemma in the history of mankind

  1. #11
    Join Date
    Jan 2008
    Beans
    185
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: greatest dilemma in the history of mankind

    underscores. Always.
    Why? Well, as the words are separated by a '_' it is easier to determine which is the first word, and which is the second one. In that way, you can group objects by defining a parent name, for example:
    login_function();
    login_msg_required = "You need to be logged in to do that."
    **America != USA | American != Usanian**
    Own a Dell XPS M1530? Join the group!

  2. #12
    Join Date
    Jun 2006
    Location
    The Netherlands
    Beans
    2,185
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: greatest dilemma in the history of mankind

    It depends on the programming language I'm programming in. I use whatever is the (de facto) standard for the language. If you use something different than what almost everybody that is programming in that particular language is using, then your code will look strange to other developers.

    In Java, the norm is to use camelCaseForMethodAndVariableNames and CapitalizedNamesForClasses.

    In Ruby, you_normally_use_lowecase_names_with_underscores for methods and variables, and CapitalizedNamesForClasses.
    Ubuntu 12.04

  3. #13
    Join Date
    Nov 2006
    Location
    Philadelphia, PA
    Beans
    Hidden!

    Re: greatest dilemma in the history of mankind

    camelCase for methods and classes.

    I tend to have underscores and all lower case variables... often I strip the vowels to make it shorter, like txt and acct.
    ThinkPad R61 14" | Fedora 14 | Core 2 Duo 2.0Ghz | 4GB DDR2 | 64GB SSD

  4. #14
    Join Date
    Aug 2008
    Beans
    Hidden!

    Re: greatest dilemma in the history of mankind

    On second thought, it depends on the language.

    In a previous post within this thread I said I usually preferred CamelCase.

    There are so-called programming languages which ignore the case in identifiers. That automatically precludes the use of CamelCase since you then could accidentially hit on a variant of a name already in use. That kind of thing would be fiendlishly difficult to debug and correct since us poor humans would find it very hard to spot this kind of conflict.

  5. #15
    Join Date
    Feb 2008
    Location
    Denmark
    Beans
    91

    Re: greatest dilemma in the history of mankind

    Coming from C I prefer underscores, but I generally follow the language "standard" style, so if it's Lisp im using hyphens.

  6. #16
    Join Date
    Mar 2008
    Beans
    58
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: greatest dilemma in the history of mankind

    Underscores for methods and variables in C.

    I type fast and sometimes I forget to make a letter capital and well, the compiler responds accordingly...
    nO EXCUSES.
    nO REGRETS.
    tAKE RESPONSIBILITY.
    a C T I V A T E.

  7. #17
    Join Date
    Dec 2006
    Location
    United Kingdom
    Beans
    562
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: greatest dilemma in the history of mankind

    Coming from an old school backround, I voted camelCase.

    I think underscores are better suited in constants, purely because in the olden days it was the custom to type constants in all upper case, so if they were two or more words long, it could look a bit unreadable if you didn't use underscores to break them up.

    I chose camelCase as the preferred one because I think that it should be clear when scanning through the code that you are looking at a discreet item. Imagine if there is a mathematical formula and you are scanning down quickly, which of the following is more readable (in a very short time):

    Code:
    //camelCase
    
    netPayThisMonth = (grossAnnualSalary - (incomeTax + nationalInsurance)) / 12;
    or

    Code:
    //camelCase
    
    net_pay_this_month = (gross_annual_salary - (income_tax + national_insurance)) / 12;
    (incidentally, the formula is rubbish but it serves to highlight the point).
    READ THIS Don't run any commands without understanding what they do, unless they are from a reliable source and have been confirmed by other experts. Serious damage can result from following malicious "advice".

  8. #18
    Join Date
    Sep 2008
    Beans
    65

    Re: greatest dilemma in the history of mankind

    CamelCase for classes and methods and underscore for the rest.
    But a lot of times I just forget to do it!

  9. #19
    Join Date
    Jul 2008
    Beans
    1,706

    Re: greatest dilemma in the history of mankind

    i use camelCase becuase my classes methods and variables tend to be one or two words

  10. #20
    Join Date
    Jul 2006
    Location
    Hertfordshire
    Beans
    454
    Distro
    Kubuntu 9.04 Jaunty Jackalope

    Re: greatest dilemma in the history of mankind

    Personally I really honestly don't mind. Picking the one that is standard in the core language API makes the decision easy and keeps things consistent, but just like the tabs vs. spaces debate I have better things to do than get religious about it...

    One thing I would say though is STICK WITH YOURS OR OTHER PEOPLES ORIGINAL DECISIONS on these things. I really hate sifting through code that interleaves different coding standards


    Oh, and off the record, Vim beats Emacs hands down

Page 2 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •