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.
  • R Rajesh R Subramanian

    Things like these are a matter of personal preference. Talking about code formatting, I call people who do this a rogue:

    void MyMagicFunc(LPVOID pParams){

    if(!pParams){
    HandleError();
    }

    //stuff goes here
    }

    I much prefer this instead:

    void MyMagicFunc(LPVOID pParams)
    {
    if(!pParams)
    {
    HandleError();
    }

    //stuff goes here
    }

    But, I'm well prepared to be called a rogue by those who don't like my style, as everyone may not like the same way of doing things. :) [ADDED] Just noticed the camel casing in my post. [/ADDED]

    It is a crappy thing, but it's life -^ Carlo Pallini

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

    I only ever use ! on a true boolean value and always use NULL when checking pointers. :) I find it easier to read, especially as I dumped Hungarian notation years ago:

    if (foo == NULL)
    {
    // I know 'foo' is a pointer
    }

    if (!bar)
    {
    // I know 'bar' is a bool
    }

    Each to their own.

    R 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

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

      Personally I prefer camel / Pascal case generally, ut reserve the use of the underscore for punctuation.. e.g. I might have Patient_Doctor which contains the many-many links between patients and doctors, and separates it from PatientDoctor which would be a collection of doctors who are easy-going.

      ___________________________________________ .\\axxx (That's an 'M')

      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
        Roger Wright
        wrote on last edited by
        #54

        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 1 Reply Last reply
        0
        • L Lost User

          I only ever use ! on a true boolean value and always use NULL when checking pointers. :) I find it easier to read, especially as I dumped Hungarian notation years ago:

          if (foo == NULL)
          {
          // I know 'foo' is a pointer
          }

          if (!bar)
          {
          // I know 'bar' is a bool
          }

          Each to their own.

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #55

          Rob Caldecott wrote:

          I only ever use ! on a true boolean value and always use NULL when checking pointers.

          Nice point. May be I will do it too. :)

          It is a crappy thing, but it's life -^ Carlo Pallini

          1 Reply Last reply
          0
          • J Jim Crafton

            Nemanja Trifunovic wrote:

            Do I see a contradiction here?

            But of course! This is all completely subjective, except for the fact that I'm right and you're wrong, VIM sucks, and using the underscore as you're proposing will undoubtedly lead to the end of the Union, and a take over of the State by leftist-grave-robbing-breast-feeding-thumb-sucking-whiner-socialists.

            ¡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
            #56

            Ah, but you're wrong, and you've hit the nail on the head! VIM is the best thing since sliced bread (who even needs a mouse anyway? and gui's? curses on all my friends!), although I'm sure it existed before sliced bread, and leftists are actually quite an agreeable bunch. So, unfortunately, I'm going to have to conclude that *you're* wrong. :)

            Paul

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

            J 1 Reply Last reply
            0
            • N Nemanja Trifunovic

              Jim Crafton wrote:

              Slow day?

              On the contrary - a busy day and I need to vent :)

              Jim Crafton wrote:

              That makes my stomach churn. For no other reason that typing the underscore is a PITA. I find camel casing more aesthetically pleasing, at least to my eyes

              Do I see a contradiction here? It makes your stomach churn for no other reason than typing, and then you say you find camel casing more aesthetically pleasing? Anyway, I can't argue with the "aesthetically pleasing" part, but it is equally hard to type.

              Programming Blog utf8-cpp

              P Offline
              P Offline
              Phil Martin
              wrote on last edited by
              #57

              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 1 Reply Last reply
              0
              • L Lost User

                Ah, but you're wrong, and you've hit the nail on the head! VIM is the best thing since sliced bread (who even needs a mouse anyway? and gui's? curses on all my friends!), although I'm sure it existed before sliced bread, and leftists are actually quite an agreeable bunch. So, unfortunately, I'm going to have to conclude that *you're* wrong. :)

                Paul

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

                J Offline
                J Offline
                Jim Crafton
                wrote on last edited by
                #58

                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 1 Reply Last reply
                0
                • 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

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

                              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

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

                                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

                                  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
                                          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