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

    0 Offline
    0 Offline
    0x3c0
    wrote on last edited by
    #4

    IHaveNeverReallyHadThisProblemBecauseIFindItEasyToBothReadAndWrite(); PerhapsItIsAMatterOfCodingStyleAndPersonalPreference(); UnderscoresTakeTooLongToWrite(); AllLowercaseMakesTheMethodNameDifficultToRead(); WithCamelCaseICanDifferentiateBetweenWordsVeryEasily(); OfCourseItDoesNotHaveAnyRealValueInNormalWriting();

    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

      D Offline
      D Offline
      Dalek Dave
      wrote on last edited by
      #5

      Nemanja Trifunovic wrote:

      Lispers have the best of both worlds (well, except for the parentheses): (get-my-precious-data-from-an-XML-file)

      Surely Lispers should have ... (get-my-prethiouth-data-from-an-EkthML-file)?

      ------------------------------------ "I am always serious about what I do, not necessarily about how I do it." Tom Baker

      U 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
        Brady Kelly
        wrote on last edited by
        #6

        That is actually Pascal Case. thisIsCamelCase. :)

        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
          phannon86
          wrote on last edited by
          #7

          As well as being the recommended notation for C#, I vastly prefer PascalCase over underscores. I think it looks tidier as well as being easy to write and read.

          He who makes a beast out of himself gets rid of the pain of being a man

          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
            Jim Crafton
            wrote on last edited by
            #8

            Slow day? Feel the need for a completely arbitrary flamewar? I'll bite :)

            Nemanja Trifunovic wrote:

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

            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.

            ¡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

            D N 2 Replies Last reply
            0
            • J Jim Crafton

              Slow day? Feel the need for a completely arbitrary flamewar? I'll bite :)

              Nemanja Trifunovic wrote:

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

              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.

              ¡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

              D Offline
              D Offline
              Dalek Dave
              wrote on last edited by
              #9

              Not flaming, agreeing. IPreferWritingThingsThisWayAsTheyArePerfectlyReadableAndNegateTheHorribleUnderscore()

              ------------------------------------ "I am always serious about what I do, not necessarily about how I do it." Tom Baker

              1 Reply Last reply
              0
              • B Brady Kelly

                That is actually Pascal Case. thisIsCamelCase. :)

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

                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

                C L 2 Replies 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
                  PIEBALDconsult
                  wrote on last edited by
                  #11

                  That's Pascal casing. Anyway, neither is inherently better, just different. If you have a choice, use what you like; if not then use what you're told to use and in ten or twenty years you'll find that you prefer it over the other.

                  N 1 Reply Last reply
                  0
                  • 0 0x3c0

                    IHaveNeverReallyHadThisProblemBecauseIFindItEasyToBothReadAndWrite(); PerhapsItIsAMatterOfCodingStyleAndPersonalPreference(); UnderscoresTakeTooLongToWrite(); AllLowercaseMakesTheMethodNameDifficultToRead(); WithCamelCaseICanDifferentiateBetweenWordsVeryEasily(); OfCourseItDoesNotHaveAnyRealValueInNormalWriting();

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

                    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

                    H 0 T R 4 Replies 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
                      Rama Krishna Vavilala
                      wrote on last edited by
                      #13

                      I prefer:

                      [myPreciousData loadFromXmlFile];

                      D 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

                        H Offline
                        H Offline
                        hairy_hats
                        wrote on last edited by
                        #14

                        Nemanja Trifunovic wrote:

                        how many time did you have to press Shift?

                        As you have to press Shift to get an underscore, I'd say about the same.

                        N 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

                          C Offline
                          C Offline
                          Christopher Duncan
                          wrote on last edited by
                          #15

                          You're tea is ready, sir. One hump or two?

                          Christopher Duncan Author of The Career Programmer and Unite the Tribes www.PracticalUSA.com

                          N 1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            That's Pascal casing. Anyway, neither is inherently better, just different. If you have a choice, use what you like; if not then use what you're told to use and in ten or twenty years you'll find that you prefer it over the other.

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

                            PIEBALDconsult wrote:

                            That's Pascal casing.

                            As I said - depends whom you ask.[^]

                            Programming Blog utf8-cpp

                            1 Reply Last reply
                            0
                            • H hairy_hats

                              Nemanja Trifunovic wrote:

                              how many time did you have to press Shift?

                              As you have to press Shift to get an underscore, I'd say about the same.

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

                              Steve_Harris wrote:

                              As you have to press Shift to get an underscore, I'd say about the same.

                              Exactly - which is why I said that underscores are easy to read but hard to write.

                              Programming Blog utf8-cpp

                              R G 2 Replies Last reply
                              0
                              • C Christopher Duncan

                                You're tea is ready, sir. One hump or two?

                                Christopher Duncan Author of The Career Programmer and Unite the Tribes www.PracticalUSA.com

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

                                Who is correct? Depends on whom you ask[^] :)

                                Programming Blog utf8-cpp

                                1 Reply Last reply
                                0
                                • R Rama Krishna Vavilala

                                  I prefer:

                                  [myPreciousData loadFromXmlFile];

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

                                  I can almost see you sitting in front of your computer, Rama, hunched over ... coveting your code ... whispering ... It is ... My Precious ... :rolleyes:

                                  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

                                    B Offline
                                    B Offline
                                    BonshatS
                                    wrote on last edited by
                                    #20

                                    I prefer CamelCase w/underscores. It's more difficult to write, but for me it's much better than trying to read a wall of text making my eyes spend x times more time on the line.

                                    1 Reply Last reply
                                    0
                                    • J Jim Crafton

                                      Slow day? Feel the need for a completely arbitrary flamewar? I'll bite :)

                                      Nemanja Trifunovic wrote:

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

                                      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.

                                      ¡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

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

                                      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

                                      J P 2 Replies 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

                                        0 Offline
                                        0 Offline
                                        0x3c0
                                        wrote on last edited by
                                        #22

                                        17 times. But I normally have my right little finger roughly over the right Shift button anyway, so this is quicker for me to type

                                        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
                                          Rajesh R Subramanian
                                          wrote on last edited by
                                          #23

                                          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

                                          OriginalGriffO C L 3 Replies 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