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. Variable Names

Variable Names

Scheduled Pinned Locked Moved The Lounge
cssdatabasetutorialquestion
62 Posts 39 Posters 1 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.
  • C Chris Meech

    dexterama wrote:

    Wayne_Gretsky

    Probably a variable that could stick handle. See Wayne Gretzky[^]. :)

    Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

    N Offline
    N Offline
    Nagy Vilmos
    wrote on last edited by
    #26

    It is hard replying to the correct message. :-D


    Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

    1 Reply Last reply
    0
    • L Lost User

      After 10 years of experience I've a tendency to fully spell out variable names in my code and in field names in my databases. I used to shorten things but I found over time that abbreviated names have a tendency to be very inconsistent from class to class or database to database. I'm getting too old to remember clever naming conventions. For example, in a production database that I'm currently slogging through (designed by someone else) the word OBJECT in some field names is OBJECT, while in others it's OBJ much like this: FIN_OBJ_CODE, OBJECT_CD_NM. As you can see, CODE also changes from CODE to CD depending upon the field. For a field that holds 'object code name' you could have: OBJ_CD_NM OBJECT_CD_NM OBJECT_CODE_NM OBJECT_CODE_NAME OBJ_CODE_NM OBJ_CODE_NAME OBJ_CD_NAME WTF_I_FORGOT_TEH_NAME By the time you spread that nonsense through parameters, objects, object properties, fields and so forth one might end up with a dozen or more names for the exact same field. objCodeName _OBJECT_CODE_NAME ObjectCodeName _strObjectCodeName @INeedANewJob NameObjectCode It may get a wee bit tedious that times but now I just spell out the entire name of the field whether I'm naming a table, field, property, parameter or whatever. In the long run I find it less confusing. In the example above, everything is ObjectCodeName. Does anyone else do this or is it just us early onset Alzhemier's victims?

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #27

      I generally like descriptive names, one developer that I worked with use to abbreviate them so much it was more of a decipher his variable names before you could work out his code.

      Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

      T 1 Reply Last reply
      0
      • L Lost User

        OriginalGriff wrote:

        whatTheFrickAmIDoingNestingLoopsThisDeep

        Shouldn't it be whatTheElephantAmIDoingNestingLoopsThisDeep?

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

        No, my coding standards specifically ban swear words.

        Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

        "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
        • S Simon_Whale

          I generally like descriptive names, one developer that I worked with use to abbreviate them so much it was more of a decipher his variable names before you could work out his code.

          Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

          T Offline
          T Offline
          TorstenH
          wrote on last edited by
          #29

          ...that comes with methods longer than 400 lines. And then one tries to remember what that abbreviation was and looses it X|

          regards Torsten When I'm not working

          S 1 Reply Last reply
          0
          • T TorstenH

            ...that comes with methods longer than 400 lines. And then one tries to remember what that abbreviation was and looses it X|

            regards Torsten When I'm not working

            S Offline
            S Offline
            Simon_Whale
            wrote on last edited by
            #30

            it normally takes me a day and a notepad to work it out oh and a large supply of :java:

            Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

            1 Reply Last reply
            0
            • L Lost User

              After 10 years of experience I've a tendency to fully spell out variable names in my code and in field names in my databases. I used to shorten things but I found over time that abbreviated names have a tendency to be very inconsistent from class to class or database to database. I'm getting too old to remember clever naming conventions. For example, in a production database that I'm currently slogging through (designed by someone else) the word OBJECT in some field names is OBJECT, while in others it's OBJ much like this: FIN_OBJ_CODE, OBJECT_CD_NM. As you can see, CODE also changes from CODE to CD depending upon the field. For a field that holds 'object code name' you could have: OBJ_CD_NM OBJECT_CD_NM OBJECT_CODE_NM OBJECT_CODE_NAME OBJ_CODE_NM OBJ_CODE_NAME OBJ_CD_NAME WTF_I_FORGOT_TEH_NAME By the time you spread that nonsense through parameters, objects, object properties, fields and so forth one might end up with a dozen or more names for the exact same field. objCodeName _OBJECT_CODE_NAME ObjectCodeName _strObjectCodeName @INeedANewJob NameObjectCode It may get a wee bit tedious that times but now I just spell out the entire name of the field whether I'm naming a table, field, property, parameter or whatever. In the long run I find it less confusing. In the example above, everything is ObjectCodeName. Does anyone else do this or is it just us early onset Alzhemier's victims?

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

              My favorite variable names are:

              $_
              $#
              $^W
              @ARGV

              The full list can be found here: http://affy.blogspot.com/p5be/ch12.htm[^]

              utf8-cpp

              T S 2 Replies Last reply
              0
              • L Lost User

                After 10 years of experience I've a tendency to fully spell out variable names in my code and in field names in my databases. I used to shorten things but I found over time that abbreviated names have a tendency to be very inconsistent from class to class or database to database. I'm getting too old to remember clever naming conventions. For example, in a production database that I'm currently slogging through (designed by someone else) the word OBJECT in some field names is OBJECT, while in others it's OBJ much like this: FIN_OBJ_CODE, OBJECT_CD_NM. As you can see, CODE also changes from CODE to CD depending upon the field. For a field that holds 'object code name' you could have: OBJ_CD_NM OBJECT_CD_NM OBJECT_CODE_NM OBJECT_CODE_NAME OBJ_CODE_NM OBJ_CODE_NAME OBJ_CD_NAME WTF_I_FORGOT_TEH_NAME By the time you spread that nonsense through parameters, objects, object properties, fields and so forth one might end up with a dozen or more names for the exact same field. objCodeName _OBJECT_CODE_NAME ObjectCodeName _strObjectCodeName @INeedANewJob NameObjectCode It may get a wee bit tedious that times but now I just spell out the entire name of the field whether I'm naming a table, field, property, parameter or whatever. In the long run I find it less confusing. In the example above, everything is ObjectCodeName. Does anyone else do this or is it just us early onset Alzhemier's victims?

                J Offline
                J Offline
                Jason Hooper
                wrote on last edited by
                #32

                public class MehGerbilToldMeToEvenThoughItFeelsWrong_Record
                {
                public string MehGerbilWouldBeProudOtherwiseIWouldntDoThis_RecordID { get; set; }
                public void ImStartingToThinkIMightHaveAProblem();
                }

                Jason

                1 Reply Last reply
                0
                • L Lost User

                  After 10 years of experience I've a tendency to fully spell out variable names in my code and in field names in my databases. I used to shorten things but I found over time that abbreviated names have a tendency to be very inconsistent from class to class or database to database. I'm getting too old to remember clever naming conventions. For example, in a production database that I'm currently slogging through (designed by someone else) the word OBJECT in some field names is OBJECT, while in others it's OBJ much like this: FIN_OBJ_CODE, OBJECT_CD_NM. As you can see, CODE also changes from CODE to CD depending upon the field. For a field that holds 'object code name' you could have: OBJ_CD_NM OBJECT_CD_NM OBJECT_CODE_NM OBJECT_CODE_NAME OBJ_CODE_NM OBJ_CODE_NAME OBJ_CD_NAME WTF_I_FORGOT_TEH_NAME By the time you spread that nonsense through parameters, objects, object properties, fields and so forth one might end up with a dozen or more names for the exact same field. objCodeName _OBJECT_CODE_NAME ObjectCodeName _strObjectCodeName @INeedANewJob NameObjectCode It may get a wee bit tedious that times but now I just spell out the entire name of the field whether I'm naming a table, field, property, parameter or whatever. In the long run I find it less confusing. In the example above, everything is ObjectCodeName. Does anyone else do this or is it just us early onset Alzhemier's victims?

                  T Offline
                  T Offline
                  TheGreatAndPowerfulOz
                  wrote on last edited by
                  #33

                  I agree 100% But I also try to find names that are as short as possible, but accurate and descriptive. I also hate underscores, I much prefer camelCasing and PascalCasing. I use camelCasing for private names & local variables, and PascalCasing for public and class names.

                  If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
                  You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

                  R 1 Reply Last reply
                  0
                  • N Nemanja Trifunovic

                    My favorite variable names are:

                    $_
                    $#
                    $^W
                    @ARGV

                    The full list can be found here: http://affy.blogspot.com/p5be/ch12.htm[^]

                    utf8-cpp

                    T Offline
                    T Offline
                    TheGreatAndPowerfulOz
                    wrote on last edited by
                    #34

                    ah, perl, a synonym for "line noise".

                    If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
                    You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

                    1 Reply Last reply
                    0
                    • L Lost User

                      After 10 years of experience I've a tendency to fully spell out variable names in my code and in field names in my databases. I used to shorten things but I found over time that abbreviated names have a tendency to be very inconsistent from class to class or database to database. I'm getting too old to remember clever naming conventions. For example, in a production database that I'm currently slogging through (designed by someone else) the word OBJECT in some field names is OBJECT, while in others it's OBJ much like this: FIN_OBJ_CODE, OBJECT_CD_NM. As you can see, CODE also changes from CODE to CD depending upon the field. For a field that holds 'object code name' you could have: OBJ_CD_NM OBJECT_CD_NM OBJECT_CODE_NM OBJECT_CODE_NAME OBJ_CODE_NM OBJ_CODE_NAME OBJ_CD_NAME WTF_I_FORGOT_TEH_NAME By the time you spread that nonsense through parameters, objects, object properties, fields and so forth one might end up with a dozen or more names for the exact same field. objCodeName _OBJECT_CODE_NAME ObjectCodeName _strObjectCodeName @INeedANewJob NameObjectCode It may get a wee bit tedious that times but now I just spell out the entire name of the field whether I'm naming a table, field, property, parameter or whatever. In the long run I find it less confusing. In the example above, everything is ObjectCodeName. Does anyone else do this or is it just us early onset Alzhemier's victims?

                      S Offline
                      S Offline
                      Single Step Debugger
                      wrote on last edited by
                      #35

                      I usually use GUIDs for a variable names – secure and consistent.

                      There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                      N L 2 Replies Last reply
                      0
                      • S Single Step Debugger

                        I usually use GUIDs for a variable names – secure and consistent.

                        There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

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

                        And easy to remember for any real geek :)

                        utf8-cpp

                        1 Reply Last reply
                        0
                        • L Lost User

                          After 10 years of experience I've a tendency to fully spell out variable names in my code and in field names in my databases. I used to shorten things but I found over time that abbreviated names have a tendency to be very inconsistent from class to class or database to database. I'm getting too old to remember clever naming conventions. For example, in a production database that I'm currently slogging through (designed by someone else) the word OBJECT in some field names is OBJECT, while in others it's OBJ much like this: FIN_OBJ_CODE, OBJECT_CD_NM. As you can see, CODE also changes from CODE to CD depending upon the field. For a field that holds 'object code name' you could have: OBJ_CD_NM OBJECT_CD_NM OBJECT_CODE_NM OBJECT_CODE_NAME OBJ_CODE_NM OBJ_CODE_NAME OBJ_CD_NAME WTF_I_FORGOT_TEH_NAME By the time you spread that nonsense through parameters, objects, object properties, fields and so forth one might end up with a dozen or more names for the exact same field. objCodeName _OBJECT_CODE_NAME ObjectCodeName _strObjectCodeName @INeedANewJob NameObjectCode It may get a wee bit tedious that times but now I just spell out the entire name of the field whether I'm naming a table, field, property, parameter or whatever. In the long run I find it less confusing. In the example above, everything is ObjectCodeName. Does anyone else do this or is it just us early onset Alzhemier's victims?

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

                          I do that as well. I tend to use complete words in most of my names. The only ones that get abbreviated tend to be for loop index variables: PHi instead of 'printhead index', for example.

                          Software Zen: delete this;

                          1 Reply Last reply
                          0
                          • H hairy_hats

                            for ( int i=0; i<10; i++)
                            {
                            for ( int eye=0; eye<10; eye++)
                            {
                            for (int aye=0; aye<10; aye++ )
                            {
                            }
                            }
                            }

                            J Offline
                            J Offline
                            Jorgen Andersson
                            wrote on last edited by
                            #38

                            for ( int i=0; i<10; i++)
                            {
                            for ( int eye=0; eye<10; eye++)
                            {
                            for (int aye=0; aye<10; aye++ )
                            {
                            for (int aargh=0; aargh<10; aargh++ )
                            {
                            }
                            }
                            }
                            }

                            Sorry, couldn't resist

                            Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

                            1 Reply Last reply
                            0
                            • V Vark111

                              "Object" smells of Hungarian notation and elderberries. ;P I'm on a crusade at my workplace to stamp out Hungarian, so I'm just particularly sensitive to those sorts of things. Anyway, Hungarian aside, I use full and complete names. Pascal case or camel case depending on context. The only abbreviation I use is "Id".

                              L Offline
                              L Offline
                              lewax00
                              wrote on last edited by
                              #39

                              Vark111 wrote:

                              I'm on a crusade at my workplace to stamp out Hungarian

                              Well in a decent IDE it's mostly redundant now anyways, you can generally just hover over the variable to find out what its type is.

                              F 1 Reply Last reply
                              0
                              • S Single Step Debugger

                                I usually use GUIDs for a variable names – secure and consistent.

                                There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

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

                                I do so as well; however, I refer to them as GloballyUniqueIdentifiers.

                                R 1 Reply Last reply
                                0
                                • R RJOberg

                                  At least I don't use x or y like some of those other sorts of people. :laugh:

                                  C Offline
                                  C Offline
                                  Clumpco
                                  wrote on last edited by
                                  #41

                                  I seem to remember using a version of Basic (TRS-80?) where i and j were predeclared integers and x, y floats?? Or maybe I was dreaming...

                                  X 1 Reply Last reply
                                  0
                                  • C Clumpco

                                    I seem to remember using a version of Basic (TRS-80?) where i and j were predeclared integers and x, y floats?? Or maybe I was dreaming...

                                    X Offline
                                    X Offline
                                    xiecsuk
                                    wrote on last edited by
                                    #42

                                    Not at all. Fortran had pre-declared integer and float variables.

                                    Wagham I'm just too old to really give a damn!!

                                    C 1 Reply Last reply
                                    0
                                    • L Lost User

                                      I once used Hungarian notation in a project and another developer looked at it, rolled his eyes, and then sighed 'oh, Hungarian notation'. He was one of those self-aggrandizaing pricks who looked down on everyone else. He eventually went off and got a job at a prestigious company earning twice what I make. I hate that guy. :-D

                                      J Offline
                                      J Offline
                                      Jonathan C Dickinson
                                      wrote on last edited by
                                      #43

                                      MehGerbil wrote:

                                      earning twice what I make.

                                      Because the code fairies saw no reason to punish him because he did not use hungarian notation. It's like an OSS project I worked on - the hungarian notation for a class was 'x' followed by a capital letter (which is two extra keystrokes). Pretty-much everything was a class and therefore 'x' was used for pretty-much any variable. It added absolutely no value to the quality of the code because everything was just 'x'. New developers would think that we just added them in front of everything so they didn't ever use the usual 'i', 'd', 'f', 'h' etc. It was completely wrong in the first place because a 'reference type' (class) should be an 'h' because it's a pointer. I only have a limited amount of keystrokes available in my life and I quickly decided to expend them on other things. Some nights I dream about each dying kitten as a developer uses hungarian notation. I don't think the code fairies will ever forgive me: the dreams won't stop.

                                      He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chineese Proverb] Jonathan C Dickinson (C# Software Engineer)

                                      1 Reply Last reply
                                      0
                                      • X xiecsuk

                                        Not at all. Fortran had pre-declared integer and float variables.

                                        Wagham I'm just too old to really give a damn!!

                                        C Offline
                                        C Offline
                                        Clumpco
                                        wrote on last edited by
                                        #44

                                        xiecsuk wrote:

                                        Not at all. Fortran had pre-declared integer and float variables.

                                        Of course! How could I have forgotten that?

                                        1 Reply Last reply
                                        0
                                        • OriginalGriffO OriginalGriff

                                          "x" and "y" are perfectly valid variables: particularly when you are talking about co-ordinates:

                                          foreach (Control c in Controls)
                                          {
                                          c.Location = new Point(x, y);
                                          x += horizontalSpacing;
                                          y += verticalSpacing;
                                          }

                                          Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

                                          K Offline
                                          K Offline
                                          Kabwla Phone
                                          wrote on last edited by
                                          #45

                                          *ONLY when you are talking about co-ordinates. Fixed that for you.

                                          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