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

    F Offline
    F Offline
    Forogar
    wrote on last edited by
    #4

    Nope - I write all code as if it is "production" code with proper naming, etc. One reason is to not have two styles of coding or naming conventions; it's just easier!

    - I would love to change the world, but they won’t give me the source code.

    1 Reply Last reply
    0
    • M Marc Clifton

      rnbergren wrote:

      Does anyone else do this?

      Nope.

      rnbergren wrote:

      Sometimes I even do.

      Because "sometimes" is "usually never."

      Latest Articles:
      Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

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

      Well said!

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

      "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
      • 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 Pfeffer
        wrote on last edited by
        #6

        Never. Either write code properly, or don't write it at all.

        Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

        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

          Sander RosselS Offline
          Sander RosselS Offline
          Sander Rossel
          wrote on last edited by
          #7

          "We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle So no, I've made doing it "right" a habit and would not even think about naming something "astr" or "ewww" :)

          Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

          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

            C Offline
            C Offline
            Chris Maunder
            wrote on last edited by
            #8

            I learned a long time ago that the temp code I'm planning on ditch often becomes the bedrock on which my applications teeter.

            cheers Chris Maunder

            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

              K Offline
              K Offline
              kmoorevs
              wrote on last edited by
              #9

              rnbergren wrote:

              Does anyone else do this?

              I have been known to use slightly 'inappropriate' abbreviations for variable names. By inappropriate, I mean in human terms 'cause the compiler doesn't care. A common abbreviation in my line of business is ASS. It appears frequently in my code, and I've never been asked to change it. :) Another example is when we used crystal reports. The application object was crAp! :laugh: The worst I've done is leave some salty comments for myself as they were well deserved. :laugh: TBH, for utility variables I always use the same ones, usually 2 or 3 letters, kind of a signature I suppose. For others, I've gotten a lot more descriptive over the last decade or so.

              "Go forth into the source" - Neal Morse "Hope is contagious"

              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

                J Offline
                J Offline
                Jon McKee
                wrote on last edited by
                #10

                If I'm writing "one-off" code I do this sometimes (e.g. a QA answer). Any code I might actually end up using for something I generally don't for three reasons: 1) harder to read for me, 2) you may never get back around to renaming everything, and 3) naming practice. Good naming is a skill just like any other.

                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
                  Mycroft Holmes
                  wrote on last edited by
                  #11

                  Never ever do this in what you think is prototype code, it will and should come back and bite you when it goes into production. Doing it right MUST become a habit, an automatic action that you don't even think about it. Name it correctly, format it correctly and use the most efficient and elegant structure you can think of, even in a throw away piece of code you don't ever expect to use.

                  Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

                  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

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

                    rnbergren wrote:

                    Anyway I frequently use variables like the following. astr - it is A String

                    Sytems vs. Apps hungarian, and they both wrong in update code; we read Joel[^] and do not use it, since VB6. I will use a descriptive name. "CurrentInput", "DescText". Never will I use a form of hungarian, no matter whether sys or apps. Don't care about company's guideluines either. I write good code, despite guidelines. We use a descriptive name. No need to include type, one can get that by hovering the mouse.

                    rnbergren wrote:

                    Does anyone else do this?

                    I hope not, that's a sign of sickness. --edit I use names; if I don't have a good one in less than a minute, I pick whatever female variable name Google offers. That takes a few minutes more. Mostly going for cat names.

                    Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                    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

                      R Offline
                      R Offline
                      Rick York
                      wrote on last edited by
                      #13

                      No, never. I learned log ago that you have to be careful when proving a concept because once you do then you are asked to put in production. You need to have a good reason why it can't be or else it will be. Therefore, always build in a fatal weakness that will require revision before you can deploy it. The problem I often had was they want a quick PoC and even quicker deployment and there is never enough time for a shiny, finished product.

                      "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                      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

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

                        No time to write crap code.

                        It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                        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

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

                          I don't crap code, but if I did: Fred, Barney, Wilma, Betty, Pebbles, BamBam, Dino I could go on...

                          Software Zen: delete this;

                          L 1 Reply Last reply
                          0
                          • G Gary R Wheeler

                            I don't crap code, but if I did: Fred, Barney, Wilma, Betty, Pebbles, BamBam, Dino I could go on...

                            Software Zen: delete this;

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

                            VB6?

                            Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                            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

                              C Offline
                              C Offline
                              CPallini
                              wrote on last edited by
                              #17

                              Yes, of course. 'foo', 'bar', 'goo' and 'boo' are my favourites. :-D

                              "In testa che avete, Signor di Ceprano?" -- Rigoletto

                              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

                                W Offline
                                W Offline
                                Wizard of Sleeves
                                wrote on last edited by
                                #18

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

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

                                  There is nothing worse, as a support engineer, than working through some code and coming to a line that says something like:

                                  /* Note: Needs to be fixed before general release. */

                                  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
                                    Martin Hart Turner
                                    wrote on last edited by
                                    #20

                                    Nope, my OCD won’t let me do such things. Quick an dirty code as well as production get the full treatment!

                                    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

                                      A Offline
                                      A Offline
                                      ACRowland
                                      wrote on last edited by
                                      #21

                                      Well, if I'm writing a very short procedure purely as a way to check it works or compare two methods that have occurred to me, and am probably doing it in a test rig, then yes, I will use short variable names for speed. But I do it properly when I rewrite the code into the actual program. One thing I will admit to: if I write a short utility function, one or two lines... you know, to return a filename without the extension, or the _n_th word in a string or something... I will often use astr, x etc. And counters are i. Always. Unless there is a nested loop, in which case one of them is j. Unless the code is long and complicated, in which case one is outer and the other inner. Should I hang my head in shame? [Please specify precise angle]

                                      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

                                        B Offline
                                        B Offline
                                        BernardIE5317
                                        wrote on last edited by
                                        #22

                                        When learning the language (C++) I utilize class names cfoobar cgoobar and choobar as needed. Never needed a cjoobar. Also as per FORTRAN i often utilize i j k for loop counters. Otherwise I utilize descriptive variable names even lengthy ones unless the lengthy type name is conveniently nearby to provide the context.

                                        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

                                          P Offline
                                          P Offline
                                          Pete Kelley
                                          wrote on last edited by
                                          #23

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