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. crap coding for myself. What variable names do you use?

crap coding for myself. What variable names do you use?

Scheduled Pinned Locked Moved The Lounge
question
36 Posts 30 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.
  • R rnbergren

    so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?

    To err is human to really elephant it up you need a computer

    R Offline
    R Offline
    Rusty Bullet
    wrote on last edited by
    #27

    IBHosed - variable for checking connections

    1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      I'm with Marc: never. Why not? Because you will not find the time to go back and correct it - it will be permanent. That's why I "do it right" even for throwaway apps: parameterized queries, proper names, no default control names from Visual Studio, and so forth. Do it right all the time, and you don't get into bad habits which enter production cycle.

      "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 AntiTwitter: @DalekDave is now a follower!

      A Offline
      A Offline
      agolddog
      wrote on last edited by
      #28

      This. And, don't use names like 'astr'. Hovering in VS will tell you it's a string. Don't waste time and space giving redundant information. I've said it for decades. It's usually not that much harder to be right than close to right. Be right.

      1 Reply Last reply
      0
      • R rnbergren

        so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?

        To err is human to really elephant it up you need a computer

        O Offline
        O Offline
        obermd
        wrote on last edited by
        #29

        I tend to use descriptive names. I keep this code around for 10 years (yep, 10 years) and I've discovered I sometimes need to go back to it. Now the oddest name I used was the loop control in a language that didn't have infinite loops. The loop was (old ALL CAPS language) DO .... UNTIL HELLFREEZESOVER Unfortunately that program terminated in 2004 when the Red Sox won the World Series. :)

        1 Reply Last reply
        0
        • R rnbergren

          so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?

          To err is human to really elephant it up you need a computer

          M Offline
          M Offline
          MSBassSinger
          wrote on last edited by
          #30

          Code right or code not. There is no try. :)

          J 1 Reply Last reply
          0
          • M MSBassSinger

            Code right or code not. There is no try. :)

            J Offline
            J Offline
            Jeff Moden
            wrote on last edited by
            #31

            From the original post... Does anyone else do this? Absolutely not. I learned a long time ago that a lot of POP code becomes production code. Like one of the other respondents posted... Code right or code not. There is no try.

            1 Reply Last reply
            0
            • W Wizard of Sleeves

              It seems like I am the only one, but I am with you on this one... sort of. The only non descriptive variables I use for i, j & k in for loops. This is a throw back to my Fortran programming days. i, j & k were integers, other letters were floats. However. When I say descriptive, I do use names like 'something', 'stuff', 'thisOne', 'thatThing', etc. Sometimes, these do creep into production code, but not in a way that is confusing to the future being that has to deal with my code.

              Nothing succeeds like a budgie without teeth.

              G Offline
              G Offline
              Gary R Wheeler
              wrote on last edited by
              #32

              Wizard of Sleeves wrote:

              I use for i, j & k in for loops

              I have the same less-than-great habit, also a hangover from my FORTRAN days (the fact that I type FORTRAN in upper case tells you how long ago that was). I have moderated the habit a little over the years, often making the names of the form _ABC_i where the _ABC_ prefix is a descriptive acronym for the array being indexed.

              Software Zen: delete this;

              1 Reply Last reply
              0
              • P Pete Kelley

                I don't object to others doing that, but to think about code I do better to "think in code".
                So the comments about "habits" really apply here. If any identifier is unconventional/silly I won't be focused on the intent of the code.
                Secondly - the code that I do as a "one-off" often turns out to be useful and adopted in another project or context. It drags down my time and effort if I need to go back and tidy up and refactor.
                Lastly - I was part of a moderately sized audience for a product demonstration once. As often happens the "presentation gods" were unkind. The demo started going awry and exposing all kinds of errors, exposing dopey-silly stuff that the developers probably NEVER intended to be part of a marketing demo.
                I felt awful for the marketing guy that had to tap dance around to try to save this humiliating, failing pitch.

                G Offline
                G Offline
                Gary R Wheeler
                wrote on last edited by
                #33

                Pete Kelley wrote:

                I felt awful for the marketing guy that had to tap dance around to try to save this humiliating, failing pitch

                Wow. It must have really been awful. In my case if I saw a marketing guy drowning in gasoline, I'd hand him a lit match...

                Software Zen: delete this;

                1 Reply Last reply
                0
                • R rnbergren

                  so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?

                  To err is human to really elephant it up you need a computer

                  D Offline
                  D Offline
                  Daniel Will
                  wrote on last edited by
                  #34

                  Err... I would never hire you if I was an interviewer. I name everything properly, even in a throw away / practice program. Habit is something that's hard to change. Have a good habit.

                  1 Reply Last reply
                  0
                  • R rnbergren

                    so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?

                    To err is human to really elephant it up you need a computer

                    U Offline
                    U Offline
                    User 14060113
                    wrote on last edited by
                    #35

                    I think you should always make the decision before you code: Is it one-way disposable code or is it production-level clean code. The latter can take up to twice as much time, so you should decide carefully. So when you decide to use throw-away code in production, you *have* to invest some more time to make it nice and neat. At least that's the way I do it.

                    1 Reply Last reply
                    0
                    • R rnbergren

                      so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?

                      To err is human to really elephant it up you need a computer

                      S Offline
                      S Offline
                      StarNamer work
                      wrote on last edited by
                      #36

                      Good naming conventions are essential | CommitStrip[^]

                      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