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

    C Offline
    C Offline
    CPallini
    wrote on last edited by
    #45

    No Camelcase, no Pascal, no undescores, no hyphen. Method names should be like foo() or goo() (names like send() and recv(), deprecated, are allowed only if you're in a poetic mood). :)

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
    [My articles]

    1 Reply Last reply
    0
    • L Le centriste

      Put on smart-ass hat

      Nemanja Trifunovic wrote:

      GetMyPreciousDataFromAnXMLFile()

      This is known as Pascal-case. Camel case version would have a small "g" at the beginning. Take off smart-ass hat

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

      And for the third time in this thread: depends whom you ask[^].

      Programming Blog utf8-cpp

      1 Reply Last reply
      0
      • H Hans Dietrich

        why_the_hell_is_XML_always_capitalized?

        Best wishes, Hans


        [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

        D Offline
        D Offline
        Dan Neely
        wrote on last edited by
        #47

        DunnoIAlwaysDoThisWhenPuttingXmlInACamelCaseString

        Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

        H 1 Reply Last reply
        0
        • D Dan Neely

          DunnoIAlwaysDoThisWhenPuttingXmlInACamelCaseString

          Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

          H Offline
          H Offline
          Hans Dietrich
          wrote on last edited by
          #48

          YeahMeToo

          Best wishes, Hans


          [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

          1 Reply Last reply
          0
          • N Nemanja Trifunovic

            Brady Kelly wrote:

            That is actually Pascal Case. thisIsCamelCase.

            Depends whom you ask[^]. I consider Pascal case to be a variant of camel case.

            Programming Blog utf8-cpp

            L Offline
            L Offline
            Le centriste
            wrote on last edited by
            #49

            After 5 years in university 15 years in the business, Pascal- and camel-case have always be the same.

            1 Reply Last reply
            0
            • R Rama Krishna Vavilala

              That was a typo. here is the actual code.

              [myPrecious loadDataFromXML];

              D Offline
              D Offline
              Douglas Troy
              wrote on last edited by
              #50

              Does that conform to the LOTR Design Pattern? ;)

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

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #51

                Rajesh R Subramanian wrote:

                void MyMagicFunc(LPVOID pParams){ if(!pParams){ HandleError(); } //stuff goes here }

                void fun(void *p)
                {
                if (!p)
                {
                cry();
                }
                /* stuff */
                }

                fixed. :laugh:

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

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