Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Empirical proof that underscores are good

Empirical proof that underscores are good

Scheduled Pinned Locked Moved The Lounge
csharpc++
40 Posts 28 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nemanja Trifunovic

    i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

    utf8-cpp

    S Offline
    S Offline
    Stefan_Lang
    wrote on last edited by
    #21

    I wonder just how much this is influenced by the fact that the english language is all lowercase by default, with very few exceptions. In german, Nouns are always uppercase, that means for a german speaker, a symbol based on german words would be more natural to read if each noun would start with an uppercase letter (e. g. FeldIndex), whereas an english speaker basing his symbol on english nouns would consider it more natural to read it all lowercase (e. g. array_index).

    1 Reply Last reply
    0
    • N Nemanja Trifunovic

      i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

      utf8-cpp

      J Offline
      J Offline
      jsc42
      wrote on last edited by
      #22

      Just in case (sic) you had wondered, the_underscore_style_of_naming_variables_etc is known as Snake Case.

      G B 2 Replies Last reply
      0
      • S Simon ORiordan from UK

        Surely that's { } ?

        D Offline
        D Offline
        Duke Carey
        wrote on last edited by
        #23

        Simon O'Riordan from UK wrote:

        Surely that's

        Stop calling me Shirley

        S 1 Reply Last reply
        0
        • D Duke Carey

          Simon O'Riordan from UK wrote:

          Surely that's

          Stop calling me Shirley

          S Offline
          S Offline
          Simon ORiordan from UK
          wrote on last edited by
          #24

          Looks like I picked the wrong day to give up sniffing glue.....

          1 Reply Last reply
          0
          • S Super Lloyd

            Stop wanking and start doing real work! :zzz: Next you'll bother us about {} instead of { } I wonder if there ever was something more pointless? Maybe it's what you argue about when your work doesn't matter, I suppose?!

            My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #25

            Super Lloyd wrote:

            Maybe it's what you argue about when your work doesn't matter, I suppose?!

            Welcome to the discussion. :-D

            1 Reply Last reply
            0
            • N Nemanja Trifunovic

              i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

              utf8-cpp

              K Offline
              K Offline
              Kirk Wood
              wrote on last edited by
              #26

              Empirical study to prove that the person doing the study had no clue. Early in we find that they included programmers and non programmers in the study. Which raises the question, "Why would someone include an audience the code wasn't meant for?" I will give the person the benefit of the doubt that he didn't know any better. At the end of the day, it is for people. And there is benefit to having the code consistent. And there is benefit to having that consistent state follow that which is least annoying to the audience. (And here is a clue: said audience writes code.

              1 Reply Last reply
              0
              • N Nemanja Trifunovic

                i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

                utf8-cpp

                G Offline
                G Offline
                Gary Huck
                wrote on last edited by
                #27

                Me? I used underScores. And I use pascal_case. And I use CamelCase. I also use Hungarian notation sometimes. I've found over the years and thousands of lines of code in many languages that there's NO ONE GOOD solution ... to just about any question. I do not, however, use tabs :)

                C 1 Reply Last reply
                0
                • J jsc42

                  Just in case (sic) you had wondered, the_underscore_style_of_naming_variables_etc is known as Snake Case.

                  G Offline
                  G Offline
                  Gary Huck
                  wrote on last edited by
                  #28

                  nice :)

                  1 Reply Last reply
                  0
                  • N Nemanja Trifunovic

                    i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

                    utf8-cpp

                    G Offline
                    G Offline
                    GenJerDan
                    wrote on last edited by
                    #29

                    Underscores are a pain in the butt if you open the code in anything other than a code editor. The spellchecker underlines the "misspelled" word, and the underscores disappear. :p

                    YouTube and My Mu[sic], Films and Windows Programs, etc.

                    1 Reply Last reply
                    0
                    • N Nemanja Trifunovic

                      i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

                      utf8-cpp

                      L Offline
                      L Offline
                      Luiz Monad
                      wrote on last edited by
                      #30

                      This study just consider normal people brain, they used "seven undergraduates" from second year, people that aren't programming for long time, if they even program instead of just frequent classes. I am coding for the last ten years, my neural network has adapted to read CamelOrPascal just as fast as this_mode. But nothing is faster than just space, there is only one way to read faster, is to read less.

                      1 Reply Last reply
                      0
                      • N Nish Nishant

                        loctrice wrote:

                        Isn't that title case ?

                        It's camel uppercase (or pascal / title case).

                        Regards, Nish


                        Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview

                        T Offline
                        T Offline
                        TNCaver
                        wrote on last edited by
                        #31

                        Loctrice is right: ThisIsTitleCase. thisIsCamelCase.

                        If you think 'goto' is evil, try writing an Assembly program without JMP.

                        N 1 Reply Last reply
                        0
                        • T TNCaver

                          Loctrice is right: ThisIsTitleCase. thisIsCamelCase.

                          If you think 'goto' is evil, try writing an Assembly program without JMP.

                          N Offline
                          N Offline
                          Nish Nishant
                          wrote on last edited by
                          #32

                          TNCaver wrote:

                          ThisIsTitleCase. thisIsCamelCase.

                          Camel case has many variants. Pascal case is upper camel case. Title case is CamelCaps. See http://en.wikipedia.org/wiki/CamelCase[^]

                          Regards, Nish


                          Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview

                          T 1 Reply Last reply
                          0
                          • N Nish Nishant

                            TNCaver wrote:

                            ThisIsTitleCase. thisIsCamelCase.

                            Camel case has many variants. Pascal case is upper camel case. Title case is CamelCaps. See http://en.wikipedia.org/wiki/CamelCase[^]

                            Regards, Nish


                            Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview

                            T Offline
                            T Offline
                            TNCaver
                            wrote on last edited by
                            #33

                            So we're all correct. However, from that wiki, "Camel case may start with a capital or, especially in programming languages, with a lowercase letter." See also the article's named anchor #Current_usage_in_computing.

                            If you think 'goto' is evil, try writing an Assembly program without JMP.

                            N 1 Reply Last reply
                            0
                            • T TNCaver

                              So we're all correct. However, from that wiki, "Camel case may start with a capital or, especially in programming languages, with a lowercase letter." See also the article's named anchor #Current_usage_in_computing.

                              If you think 'goto' is evil, try writing an Assembly program without JMP.

                              N Offline
                              N Offline
                              Nish Nishant
                              wrote on last edited by
                              #34

                              Yeah typically I'd assume these : camelCase PascalCase (same as TitleCase).

                              Regards, Nish


                              Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview

                              1 Reply Last reply
                              0
                              • R Ron Beyer

                                Quote:

                                One main difference is that subjects were trained mainly in the underscore style and were all programmers. While results indicate no difference in accuracy between the two styles, subjects recognize identifiers in the underscore style more quickly.

                                [sarcasm] So its a non-biased study then? [/end sarcasm]

                                N Offline
                                N Offline
                                Narf the Mouse
                                wrote on last edited by
                                #35

                                There's one of two conclusions that can be drawn: 1) They tried to improve on the previous study by making a biased study. (The phrase refers to their own study) 2) They tried to improve on a previous biased study. (The phrase refers to the previous study they are comparing and contrasting their own with).

                                1 Reply Last reply
                                0
                                • N Nemanja Trifunovic

                                  i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

                                  utf8-cpp

                                  R Offline
                                  R Offline
                                  RafagaX
                                  wrote on last edited by
                                  #36

                                  I find your lack of faith in camelCase and PascalCase disturbing...

                                  CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

                                  1 Reply Last reply
                                  0
                                  • N Nemanja Trifunovic

                                    i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

                                    utf8-cpp

                                    B Offline
                                    B Offline
                                    BotReject
                                    wrote on last edited by
                                    #37

                                    Underscores may make text without spaces more readable, however, just how long do you think variable names should be? variable names that are too long degrade readability anyway. IUsuallyPreferThisStyle because I find it easier to type.

                                    1 Reply Last reply
                                    0
                                    • J jsc42

                                      Just in case (sic) you had wondered, the_underscore_style_of_naming_variables_etc is known as Snake Case.

                                      B Offline
                                      B Offline
                                      Brisingr Aerowing
                                      wrote on last edited by
                                      #38

                                      Yes. It is used quite a bit in Python. (Seriously. It is.)

                                      brisingr_aerowing@Gryphon-PC $ rake in_the_dough Raking in the dough brisingr_aerowing@Gryphon-PC $ make lots_of_money Making lots_of_money

                                      1 Reply Last reply
                                      0
                                      • N Nemanja Trifunovic

                                        i_have_always_preferred_this_style ToCamelOrPascalOne and now there is a study that confirms my point of view[^] :cool:

                                        utf8-cpp

                                        J Offline
                                        J Offline
                                        jibalt
                                        wrote on last edited by
                                        #39

                                        From the abstract: "subjects were trained mainly in the underscore style" ... ... which makes this study useless for determining which is better. And any proper study would have to accurately account for the cost of longer identifiers, which can make code layout more difficult, among other things.

                                        1 Reply Last reply
                                        0
                                        • G Gary Huck

                                          Me? I used underScores. And I use pascal_case. And I use CamelCase. I also use Hungarian notation sometimes. I've found over the years and thousands of lines of code in many languages that there's NO ONE GOOD solution ... to just about any question. I do not, however, use tabs :)

                                          C Offline
                                          C Offline
                                          Chad3F
                                          wrote on last edited by
                                          #40

                                          How about we just simplify things and replace all these nasty and confusing concatenated word styles with something straight forward, like integer based identifiers.. Old:

                                          int calculateFactorial(int num) /* or calculate_factorial() */
                                          {
                                          int value;
                                          int i;

                                          value = 1;

                                          for(i = 2; i < num; i++)
                                          value *= i;

                                          return value;
                                          }

                                          New:

                                          int x9F37A170(int x00000001)
                                          {
                                          int x00000002;
                                          int x00000003;

                                          x00000002 = 1;

                                          for(x00000003 = 2; x00000003 < x00000001; x00000003++)
                                          x00000002 *= x00000003;

                                          return x00000002;
                                          }

                                          Now doesn't that just make things so much cleaner! :omg: And lets not forget the inherent localization benefits. :-D Of course, then there will be flame wars over whether to start it with a lower 'x' or an upper 'X', if the hex characters should be upper or lower, or do we use 32-bit identifiers or 64-bit. ;P

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups