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.
  • D Dalek Dave

    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 Offline
    U Offline
    urbane tiger
    wrote on last edited by
    #82

    ThatShouldHaveBeenTheLastWordOnTheMatter but IF-ALL-YOUVE-GOT-IS-A-BAUDOT-TELETYPE-THEN-YOU-DONT-HAVE-THE-LUXURY-OF-LOWERCASE which is probably why Cobol & Fortran programs usually employ HYPHENATED-UPPER-CASE

    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
      Member 3848036
      wrote on last edited by
      #83

      I usually use both when I get stuck with a long name. Why not Get_MyPreciousData_From_AnXMLFile() I find this makes it easier to read the key components by grouping adjective/noun groups and separating with underscores. In practice, I find I rarely have to use this and when I do, I usually only need one underscore and never more than two. My real preference would be break the operation into objects and use myXMLFile.PreciousData() or myPreciousData.LoadFrom(myXMLFile) or new PreciousData(myXMLFile) When push comes to shove, though don't pick an either-or solution. Combine them for easiest reading.

      1 Reply Last reply
      0
      • N Nemanja Trifunovic

        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

        G Offline
        G Offline
        ghle
        wrote on last edited by
        #84

        Nemanja Trifunovic wrote:

        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.

        NOT EXACTLY. You have to insert 16 EXTRA shifted characters, so that is 32 EXTRA key presses for the same lower-case function call - 16 shifts and 16 underscores extra, versus 16 extra shift for upper-case only. Personally, I don't like UGLY code, and mixing styles makes the overall code ugly. So, I use the MS standard (standard of the language/day) or the Linux/C standard, or Borland, or whatever, just so there is a common style throughout. strHungarian, under_scores, CamelCase, or _ALLCAPS - use them all. Not saying I like it, but the code is pretty. Now, if it would only work as well as it looks. X|

        Gary

        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

          K Offline
          K Offline
          KerimF
          wrote on last edited by
          #85

          At least now, I learnt that the name of the notation that I always liked to use while on my isolated island and since about 30 years... is camelCase.

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

            I can read camelCase more easily than underscores. Mainly because I've seen much more camelCase code. The extra benefit is that I have shorter lines because of shorter variable names. I try to keep within 80 characters of width per line because I hate scrolling horizontally. Doing underscores feels unusual because I'm not used to holding Shift and hitting any key outside of the character keys.

            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

              R Offline
              R Offline
              Ray Cassick
              wrote on last edited by
              #87

              Dude, really... that's like asking how many times you has to press the letter 'e'. What is it about everyone that is scared of typing? C++ people say that VB is 'too verbose'. now the discussion about uppercase letters... Just work in assembler, or machine language.


              LinkedIn[^] | Blog[^] | Twitter[^]

              1 Reply Last reply
              0
              • N Nemanja Trifunovic

                M Towler wrote:

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

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

                Programming Blog utf8-cpp

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

                :laugh: Ah yes, the definition of compromise - everyone is unhappy :)

                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
                  Bruce Patin
                  wrote on last edited by
                  #89

                  I have always disliked underscores in names for a reason no one has mentioned: When I am visually scanning code, spaces between strings of characters indicate the end of one name and the beginning of another, and underscores look a lot like spaces. This makes it harder for me to understand the code quickly. Code and prose are two different things. Of course, I also strongly dislike having to add that extra underscore character with a shift and awkward reach to a key at the top of the keyboard that I have to look for, since it falls outside the scope of my touch typing practice. And, in some display situations, the underscore disappears in an underline of the whole name. And, what is most frustrating, I have occasionally seen two or more underscores used together. In many fonts, it is very difficult to tell how many underscores there actually are.

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

                    I thought EveryoneLovesCamelNotation:~


                    All generalizations are wrong, including this one! (\ /) (O.o) (><)

                    1 Reply Last reply
                    0
                    • C Cedric Moonen

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

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

                      C Offline
                      C Offline
                      csharp3r
                      wrote on last edited by
                      #91

                      Cedric Moonen wrote:

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

                      totally agree... I hate using underscores in methods and variable names.. I think the best and easiest to read and write is CamelCasing :) ICouldReadACamelCasedBookWithoutAnyProblems :-D

                      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