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. CamelCase naming convention

CamelCase naming convention

Scheduled Pinned Locked Moved The Lounge
csharpc++javacomtools
91 Posts 51 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.
  • J Jim Crafton

    Preposterous! Absurdities stacked on inanities, turgid logic piled upon vapid conundrums! I'm convinced beyond a shadow of a doubt that you're wrong!

    ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog Just Say No to Web 2 Point Oh

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

    ...oh, and Lisp is cool. And so is Haskell :) Definitely been hanging too much with the dark side :). But this all leads me to believe, without doubt, that you're wrong. Speaking of inane deductions, which your post exemplifies! ;P

    Paul

    The flight towards the light I'll stay in the lava for life Ísland

    C 1 Reply Last reply
    0
    • P Phil Martin

      Nemanja Trifunovic wrote:

      Anyway, I can't argue with the "aesthetically pleasing" part, but it is equally hard to type.

      I think capital letters are far easier to type than an underscore. All the letters on my keyboard are just one key away, whereas the underscore I have to move my cute lil' pinky up two rows. My left ring finger can handle taking up the responsibility of the left pinky just find. Hmm, talking about fingers is really weird. Good topic though! I reckon being able to type with spaces would be better, and have the editor condense it to whatever form is required. Interestingly, on that topic, I don't actually type the capitals much any more, I type about half the method in lower case, then ctrl+space finishes the word for me, and fixes up my capitalisation. Yay for tools!

      N Offline
      N Offline
      Nemanja Trifunovic
      wrote on last edited by
      #60

      Phil Martin... wrote:

      I type about half the method in lower case, then ctrl+space finishes the word for me, and fixes up my capitalisation. Yay for tools!

      Same here, except that I use vim's Ctrl-P :)

      Programming Blog utf8-cpp

      1 Reply Last reply
      0
      • N Nemanja Trifunovic

        Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

        GetMyPreciousDataFromAnXMLFile()

        With undrescores it is at least easy to read if not to write:

        get_my_precious_data_from_an_XML_file()

        And of course, there is always a way to make it easy to write but hard to read:

        getmypreciousdatafromanXMLfile()

        Lispers have the best of both worlds (well, except for the parentheses):

        (get-my-precious-data-from-an-XML-file)

        I feel better now - feel free to vote me down :)

        Programming Blog utf8-cpp

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #61

        Just use shorter identifiers. I've started to use namespaces a lot for that reason. I use a notation that looks like this: IO::Backup::Database(...). My apologies if namespaces aren't available in your toolset. Personally, I prefer camel case over underscores in long identifiers.

        -- Kein Mitleid Für Die Mehrheit

        1 Reply Last reply
        0
        • R Roger Wright

          I prefer to use names that contain umlauts[^] over each vowel. Reading it is a bitch, and typing it is much harder, but it's my own style, and I like that. It's important, I think, to express one's individuality in the workplace.

          "A Journey of a Thousand Rest Stops Begins with a Single Movement"

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #62

          I guess my first name has made a good impression on you then? Not sure if I want to impress you even further with Jörgën though. People could mistake me for a french man! ;)

          -- Kein Mitleid Für Die Mehrheit

          1 Reply Last reply
          0
          • N Nemanja Trifunovic

            Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

            GetMyPreciousDataFromAnXMLFile()

            With undrescores it is at least easy to read if not to write:

            get_my_precious_data_from_an_XML_file()

            And of course, there is always a way to make it easy to write but hard to read:

            getmypreciousdatafromanXMLfile()

            Lispers have the best of both worlds (well, except for the parentheses):

            (get-my-precious-data-from-an-XML-file)

            I feel better now - feel free to vote me down :)

            Programming Blog utf8-cpp

            R Offline
            R Offline
            rriosarias
            wrote on last edited by
            #63

            The main problem in you examples is not the case, but the lenght of the function. GetMyXML() is not difficult to read at all. If you function or variable names are that long, you might need to split the functionality into smaller parts.

            1 Reply Last reply
            0
            • N Nemanja Trifunovic

              Computafreak wrote:

              IHaveNeverReallyHadThisProblemBecauseIFindItEasyToBothReadAndWrit

              You find that easy to read? :~ As for ease of writing, how many time did you have to press Shift?

              Programming Blog utf8-cpp

              T Offline
              T Offline
              ToniWett
              wrote on last edited by
              #64

              Yes - it's readable! BTW: ... the same number you had to press both :thumbsdown: underscore and shift simultaneously (swiss german keyboard)!!!

              1 Reply Last reply
              0
              • N Nemanja Trifunovic

                Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

                GetMyPreciousDataFromAnXMLFile()

                With undrescores it is at least easy to read if not to write:

                get_my_precious_data_from_an_XML_file()

                And of course, there is always a way to make it easy to write but hard to read:

                getmypreciousdatafromanXMLfile()

                Lispers have the best of both worlds (well, except for the parentheses):

                (get-my-precious-data-from-an-XML-file)

                I feel better now - feel free to vote me down :)

                Programming Blog utf8-cpp

                T Offline
                T Offline
                T800G
                wrote on last edited by
                #65

                YouCan'tHaveACamelWithoutAHump :laugh:

                1 Reply Last reply
                0
                • N Nemanja Trifunovic

                  Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

                  GetMyPreciousDataFromAnXMLFile()

                  With undrescores it is at least easy to read if not to write:

                  get_my_precious_data_from_an_XML_file()

                  And of course, there is always a way to make it easy to write but hard to read:

                  getmypreciousdatafromanXMLfile()

                  Lispers have the best of both worlds (well, except for the parentheses):

                  (get-my-precious-data-from-an-XML-file)

                  I feel better now - feel free to vote me down :)

                  Programming Blog utf8-cpp

                  A Offline
                  A Offline
                  Alan Balkany
                  wrote on last edited by
                  #66

                  Back in the mainframe days, before PCs were invented, underscores were a standard way of making long identifiers readable. As people have observed, it's slightly more effort to type, but code is only written once and read many times. More effort and expense per line of code is expended in maintenance than initially creating it, so if it makes your code more readable it may be worth it.

                  1 Reply Last reply
                  0
                  • N Nemanja Trifunovic

                    Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

                    GetMyPreciousDataFromAnXMLFile()

                    With undrescores it is at least easy to read if not to write:

                    get_my_precious_data_from_an_XML_file()

                    And of course, there is always a way to make it easy to write but hard to read:

                    getmypreciousdatafromanXMLfile()

                    Lispers have the best of both worlds (well, except for the parentheses):

                    (get-my-precious-data-from-an-XML-file)

                    I feel better now - feel free to vote me down :)

                    Programming Blog utf8-cpp

                    G Offline
                    G Offline
                    grgran
                    wrote on last edited by
                    #67

                    GetMyPreciousDataFromAnXMLFile() get_my_precious_data_from_an_XML_file() Either way that's a LOT of typing wouldn't this be better: Gmpdff() ?

                    N 1 Reply Last reply
                    0
                    • G grgran

                      GetMyPreciousDataFromAnXMLFile() get_my_precious_data_from_an_XML_file() Either way that's a LOT of typing wouldn't this be better: Gmpdff() ?

                      N Offline
                      N Offline
                      Nemanja Trifunovic
                      wrote on last edited by
                      #68

                      grgran wrote:

                      wouldn't this be better: Gmpdff()

                      Nah - you still need to hit the Shift key. Maybe: gmpdff()

                      Programming Blog utf8-cpp

                      G 1 Reply Last reply
                      0
                      • N Nemanja Trifunovic

                        grgran wrote:

                        wouldn't this be better: Gmpdff()

                        Nah - you still need to hit the Shift key. Maybe: gmpdff()

                        Programming Blog utf8-cpp

                        G Offline
                        G Offline
                        grgran
                        wrote on last edited by
                        #69

                        Nemanja Trifunovic wrote:

                        grgran wrote: wouldn't this be better: Gmpdff() Nah - you still need to hit the Shift key. Maybe: gmpdff()

                        *blush* ... of course you are right, clearly just reading the thread tainted me :-)

                        1 Reply Last reply
                        0
                        • N Nemanja Trifunovic

                          Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

                          GetMyPreciousDataFromAnXMLFile()

                          With undrescores it is at least easy to read if not to write:

                          get_my_precious_data_from_an_XML_file()

                          And of course, there is always a way to make it easy to write but hard to read:

                          getmypreciousdatafromanXMLfile()

                          Lispers have the best of both worlds (well, except for the parentheses):

                          (get-my-precious-data-from-an-XML-file)

                          I feel better now - feel free to vote me down :)

                          Programming Blog utf8-cpp

                          M Offline
                          M Offline
                          M Towler
                          wrote on last edited by
                          #70

                          Where I work we use both at the same time, so everyone is offended :) CamelCaseForClassAndTypeNames underscores_for_variable_and_method_names

                          N 1 Reply Last reply
                          0
                          • N Nemanja Trifunovic

                            Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

                            GetMyPreciousDataFromAnXMLFile()

                            With undrescores it is at least easy to read if not to write:

                            get_my_precious_data_from_an_XML_file()

                            And of course, there is always a way to make it easy to write but hard to read:

                            getmypreciousdatafromanXMLfile()

                            Lispers have the best of both worlds (well, except for the parentheses):

                            (get-my-precious-data-from-an-XML-file)

                            I feel better now - feel free to vote me down :)

                            Programming Blog utf8-cpp

                            P Offline
                            P Offline
                            Plamen Dragiyski
                            wrote on last edited by
                            #71

                            Actually as a JS coder I preffer that naming:

                            //Get My Precious Data From An XML File
                            gmpdfaxmlf();

                            Publish the code without comments :) And make sure you keep copy of it with comments! :P

                            1 Reply Last reply
                            0
                            • N Nemanja Trifunovic

                              Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

                              GetMyPreciousDataFromAnXMLFile()

                              With undrescores it is at least easy to read if not to write:

                              get_my_precious_data_from_an_XML_file()

                              And of course, there is always a way to make it easy to write but hard to read:

                              getmypreciousdatafromanXMLfile()

                              Lispers have the best of both worlds (well, except for the parentheses):

                              (get-my-precious-data-from-an-XML-file)

                              I feel better now - feel free to vote me down :)

                              Programming Blog utf8-cpp

                              T Offline
                              T Offline
                              Terry Meritt
                              wrote on last edited by
                              #72

                              I have always used Camel Case because it is easy to read. I hate reaching for the underscore anyhow. Give me the main three rows of keys for ease of typing. Anyhow it is part of the accepted coding conditions for VB programming.

                              N 1 Reply Last reply
                              0
                              • M M Towler

                                Where I work we use both at the same time, so everyone is offended :) CamelCaseForClassAndTypeNames underscores_for_variable_and_method_names

                                N Offline
                                N Offline
                                Nemanja Trifunovic
                                wrote on last edited by
                                #73

                                M Towler wrote:

                                we use both at the same time, so everyone is offended

                                But at least everybody knows the other side is offended as well :)

                                Programming Blog utf8-cpp

                                M 1 Reply Last reply
                                0
                                • T Terry Meritt

                                  I have always used Camel Case because it is easy to read. I hate reaching for the underscore anyhow. Give me the main three rows of keys for ease of typing. Anyhow it is part of the accepted coding conditions for VB programming.

                                  N Offline
                                  N Offline
                                  Nemanja Trifunovic
                                  wrote on last edited by
                                  #74

                                  Terry Meritt wrote:

                                  Anyhow it is part of the accepted coding conditions for VB programming.

                                  I admit I didn't have VB in mind when I started the thread :)

                                  Programming Blog utf8-cpp

                                  T 1 Reply Last reply
                                  0
                                  • C Cedric Moonen

                                    I really don't like having underscores in method or variable names :~. Just a matter of choice. And I find the CamelCase notation not really difficult to read or write.

                                    Cédric Moonen Software developer
                                    Charting control [v2.0 - Updated] OpenGL game tutorial in C++

                                    S Offline
                                    S Offline
                                    ssclaire
                                    wrote on last edited by
                                    #75

                                    Cedric Moonen wrote:

                                    I really don't like having underscores in method or variable names

                                    Agreed. I'll manage either way but I prefer keeping a single symbol (variable/method name) easily discernable unlike:

                                    unfortunately_wrong_because = this_symbol - looks_a_lot_like - this-symbol;

                                    1 Reply Last reply
                                    0
                                    • N Nemanja Trifunovic

                                      Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:

                                      GetMyPreciousDataFromAnXMLFile()

                                      With undrescores it is at least easy to read if not to write:

                                      get_my_precious_data_from_an_XML_file()

                                      And of course, there is always a way to make it easy to write but hard to read:

                                      getmypreciousdatafromanXMLfile()

                                      Lispers have the best of both worlds (well, except for the parentheses):

                                      (get-my-precious-data-from-an-XML-file)

                                      I feel better now - feel free to vote me down :)

                                      Programming Blog utf8-cpp

                                      B Offline
                                      B Offline
                                      byff
                                      wrote on last edited by
                                      #76

                                      To the OP: agreed, in general. But for small variable names, camelCasing is definitely easier and doesn't exact too harsh a reading penalty. The difficulty in reading grows with each word added, so if you can keep your names to two-three individual components, you should be all right. By contrast, sticking in a bunch of underscores can seriously extend the length of a variable name, which I begin to find just about as onerous as reading scrunched names. So, my advice is to use underscores if you really need them, but be as sparing as possible. (Hint: they do make a great way to abbreviate certain groups, such as "to", "of the", and other article conglomerations.)

                                      1 Reply Last reply
                                      0
                                      • L Lost User

                                        ...oh, and Lisp is cool. And so is Haskell :) Definitely been hanging too much with the dark side :). But this all leads me to believe, without doubt, that you're wrong. Speaking of inane deductions, which your post exemplifies! ;P

                                        Paul

                                        The flight towards the light I'll stay in the lava for life Ísland

                                        C Offline
                                        C Offline
                                        Curtis J
                                        wrote on last edited by
                                        #77

                                        If you want to talk about the dark side, I've been working in Perl lately! So I use what's appropriate for the language. For C++, I use camelCase. For Perl, I use @the_underscores. (I do have to admit - C#? Get away, get away! is my opinion about that language.)

                                        1 Reply Last reply
                                        0
                                        • N Nemanja Trifunovic

                                          Terry Meritt wrote:

                                          Anyhow it is part of the accepted coding conditions for VB programming.

                                          I admit I didn't have VB in mind when I started the thread :)

                                          Programming Blog utf8-cpp

                                          T Offline
                                          T Offline
                                          Terry Meritt
                                          wrote on last edited by
                                          #78

                                          The best thing would be for everyone to follow the accepted coding conventions for the language they are using. Sure makes it a whole lot easier when you have to take over an existing project if the previous programmer did use the coding conventions. I have re-written enough apps in my time because the orginal or previous programmer didn't follow them and it took me extra time to decode.

                                          N 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