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 SS

    What is all this camel case, pascal case, underscores. I don't need any of them if keep my variables to 6 characters (1 character is preferred). ;P p.s. see my signature

    SS => Qualified in Submarines "We sleep soundly in our beds because rough men stand ready in the night to visit violence on those who would do us harm". Winston Churchill "Real programmers can write Fortran in any language". Unknown

    G Offline
    G Offline
    Gary Wheeler
    wrote on last edited by
    #31

    Jim (SS) wrote:

    "Real programmers can write Fortran in any language". Unknown

    Real programmers spell it FORTRAN like God, IBM, and other TLA's intended.

    Software Zen: delete this;

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

      B Offline
      B Offline
      bulg
      wrote on last edited by
      #32

      Jim Crafton wrote:

      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

      You may be Right.

      Jim Crafton wrote:

      VIM sucks

      Then again, you're probably just lost. Try fid=2605.

      1 Reply Last reply
      0
      • G Gary Wheeler

        Jim (SS) wrote:

        "Real programmers can write Fortran in any language". Unknown

        Real programmers spell it FORTRAN like God, IBM, and other TLA's intended.

        Software Zen: delete this;

        J Offline
        J Offline
        Jim SS
        wrote on last edited by
        #33

        Gary Wheeler wrote:

        spell it FORTRAN

        I was wondering how many other people even knew that. Even C# and Java still allow GOTOs, so the statement is still true.:cool:

        SS => Qualified in Submarines "We sleep soundly in our beds because rough men stand ready in the night to visit violence on those who would do us harm". Winston Churchill "Real programmers can write FORTRAN in any language". Unknown

        G 1 Reply Last reply
        0
        • N Nish Nishant

          Nemanja Trifunovic wrote:

          GetMyPreciousDataFromAnXMLFile()

          I find this to be quite readable.

          Nemanja Trifunovic wrote:

          get_my_precious_data_from_an_XML_file()

          On the other hand, this I find to be ugly and slightly harder to read. My brain is auto-wired to recognize a new word when it sees an upper case letter, but with an underscore not so much.

          Regards, Nish


          Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
          My latest book : C++/CLI in Action / Amazon.com link

          E Offline
          E Offline
          Eytukan
          wrote on last edited by
          #34

          So you are already here :laugh: . lol I was quickly looking for the "familiar" names that have replied to this thread. funny. You are there :)

          Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.

          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

            E Offline
            E Offline
            Eytukan
            wrote on last edited by
            #35

            Camel for president.

            Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.

            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

              E Offline
              E Offline
              Eytukan
              wrote on last edited by
              #36

              Nemanja Trifunovic wrote:

              getmypreciousdatafromanXMLfile()

              You are really cunning. :laugh: That's not a camel, that's a snake with a big ass. A real camel would look something like this:

              getMyPreciousDataFromAnXMLFile

              Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.

              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

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

                why_the_hell_is_XML_always_capitalized?

                Best wishes, Hans


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

                P D 2 Replies Last reply
                0
                • G Gary Wheeler

                  Jim (SS) wrote:

                  "Real programmers can write Fortran in any language". Unknown

                  Real programmers spell it FORTRAN like God, IBM, and other TLA's intended.

                  Software Zen: delete this;

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #38

                  Huh? I thought it was ForTran. :confused:

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

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #39

                    Capitalized? No. Leveraged? Yes. :-D

                    1 Reply Last reply
                    0
                    • D Douglas Troy

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

                      R Offline
                      R Offline
                      Rama Krishna Vavilala
                      wrote on last edited by
                      #40

                      That was a typo. here is the actual code.

                      [myPrecious loadDataFromXML];

                      D 1 Reply Last reply
                      0
                      • J Jim SS

                        Gary Wheeler wrote:

                        spell it FORTRAN

                        I was wondering how many other people even knew that. Even C# and Java still allow GOTOs, so the statement is still true.:cool:

                        SS => Qualified in Submarines "We sleep soundly in our beds because rough men stand ready in the night to visit violence on those who would do us harm". Winston Churchill "Real programmers can write FORTRAN in any language". Unknown

                        G Offline
                        G Offline
                        Gary Wheeler
                        wrote on last edited by
                        #41

                        Much better.

                        Software Zen: delete this;

                        1 Reply Last reply
                        0
                        • P PIEBALDconsult

                          Huh? I thought it was ForTran. :confused:

                          G Offline
                          G Offline
                          Gary Wheeler
                          wrote on last edited by
                          #42

                          FORmula TRANslation[^]

                          Software Zen: delete this;

                          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
                            Le centriste
                            wrote on last edited by
                            #43

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

                              OriginalGriffO Offline
                              OriginalGriffO Offline
                              OriginalGriff
                              wrote on last edited by
                              #44

                              I agree, but prefer

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

                              Dunno why, been using it since I started with C (so it was probably a company style thing at the time). Either way, it is a lot clearer how the brackets match up.

                              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                              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

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