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. Other Discussions
  3. The Weird and The Wonderful
  4. variable names - who cares!?

variable names - who cares!?

Scheduled Pinned Locked Moved The Weird and The Wonderful
comgame-devquestion
32 Posts 15 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.
  • C Chris Maunder

    I spent too much time dealing with numerical modelling suites written in FORTRAN written exactly the same way. Thousands and thousands of lines, and all the variables "x", "xx", "xxx" etc. Comments? We're physicists, not literary majors. We don't need no stinkin' comments. The code is obvious anyway... :doh: :sigh:

    cheers, Chris Maunder

    CodeProject.com : C++ MVP

    D Offline
    D Offline
    Dan Neely
    wrote on last edited by
    #5

    Chris Maunder wrote:

    Comments? We're physicists, not literary majors. We don't need no stinkin' comments. The code is obvious anyway...

    ... 30 minutes of pensive pacing. As I said, it's obvious. :laugh:

    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

    1 Reply Last reply
    0
    • C Chris Maunder

      I spent too much time dealing with numerical modelling suites written in FORTRAN written exactly the same way. Thousands and thousands of lines, and all the variables "x", "xx", "xxx" etc. Comments? We're physicists, not literary majors. We don't need no stinkin' comments. The code is obvious anyway... :doh: :sigh:

      cheers, Chris Maunder

      CodeProject.com : C++ MVP

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #6

      Chris Maunder wrote:

      numerical modelling suites written in FORTRAN written exactly the same way. Thousands and thousands of lines, and all the variables "x", "xx", "xxx" etc.

      Ah yes, I do recall my grandfather's Fortran IV book being loaded with this kind of stuff :)

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

      1 Reply Last reply
      0
      • S Steven A Lowe

        a friend of mine - many years ago - was asked to port a physics simulation program from one platform to another. The software performed beautifully, was efficient, and had won awards for educational excellence etc. the source code was several thousand lines of assembly, which was large but not too large for that platform and era. The program had two comments in it, one word each. They were not helpful. The variable naming convention was even more interesting. It seems the original author [a physicist/mathematician, in all fairness] treated variable names like a Pez dispenser. The first variable in the program was named "A", the second was named "B", and so on. When he got to Z he started over with A1, then B1, etc. The program had a lot of variables, I think the last variable was named BB21. Porting the application was not too difficult, as the two platforms had very similar instruction sets. Debugging it, on the other hand, was an exercise in insanity!

        Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

        R Offline
        R Offline
        Rob Graham
        wrote on last edited by
        #7

        When dealing with punch cards, short variable names are a blessing.

        S C 2 Replies Last reply
        0
        • R Rob Graham

          When dealing with punch cards, short variable names are a blessing.

          S Offline
          S Offline
          Steven A Lowe
          wrote on last edited by
          #8

          :laugh: so is a lighter :laugh: (this program definitely did not originate on punch cards, it was on an Apple ][e!)

          Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

          P 1 Reply Last reply
          0
          • S Steven A Lowe

            :laugh: so is a lighter :laugh: (this program definitely did not originate on punch cards, it was on an Apple ][e!)

            Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #9

            Steven A. Lowe wrote:

            so is a lighter

            :laugh: Punch cards are great for the fireplace on cold winter nights :) About your reference to the Apple ][e, I remember my old Commodore 64 and 128 were limited to only the first characters counting in the variable name.

            "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

            S P 2 Replies Last reply
            0
            • P Paul Conrad

              Steven A. Lowe wrote:

              so is a lighter

              :laugh: Punch cards are great for the fireplace on cold winter nights :) About your reference to the Apple ][e, I remember my old Commodore 64 and 128 were limited to only the first characters counting in the variable name.

              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

              S Offline
              S Offline
              Steven A Lowe
              wrote on last edited by
              #10

              hmmm...i don't remember that being a limit of the macro-assembler, but then again i don't remember a lot of things from way back then :laugh:

              Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

              P 1 Reply Last reply
              0
              • S Steven A Lowe

                hmmm...i don't remember that being a limit of the macro-assembler, but then again i don't remember a lot of things from way back then :laugh:

                Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #11

                I don't recall what the limit was in the macro assembler, but in Commodore Basic it was only the first two characters counting.

                "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                L 1 Reply Last reply
                0
                • P Paul Conrad

                  Steven A. Lowe wrote:

                  so is a lighter

                  :laugh: Punch cards are great for the fireplace on cold winter nights :) About your reference to the Apple ][e, I remember my old Commodore 64 and 128 were limited to only the first characters counting in the variable name.

                  "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                  I first learned programming in BASIC-Plus on a PDP-11. Unless you issued the EXTEND command, variable names were limited to one character and perhaps one digit. (Well there could also be a % or $ too.)

                  P 1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    I first learned programming in BASIC-Plus on a PDP-11. Unless you issued the EXTEND command, variable names were limited to one character and perhaps one digit. (Well there could also be a % or $ too.)

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #13

                    PIEBALDconsult wrote:

                    there could also be a % or $

                    I remember that. $ for strings, and % for integer if I recall correctly. Funny thing, I still have the old Commodore sitting in the eave/storage thingee, 10 feet away from this desk. Maybe I'll dig it out one of these days :)

                    "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                    P L 2 Replies Last reply
                    0
                    • S Steven A Lowe

                      a friend of mine - many years ago - was asked to port a physics simulation program from one platform to another. The software performed beautifully, was efficient, and had won awards for educational excellence etc. the source code was several thousand lines of assembly, which was large but not too large for that platform and era. The program had two comments in it, one word each. They were not helpful. The variable naming convention was even more interesting. It seems the original author [a physicist/mathematician, in all fairness] treated variable names like a Pez dispenser. The first variable in the program was named "A", the second was named "B", and so on. When he got to Z he started over with A1, then B1, etc. The program had a lot of variables, I think the last variable was named BB21. Porting the application was not too difficult, as the two platforms had very similar instruction sets. Debugging it, on the other hand, was an exercise in insanity!

                      Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

                      C Offline
                      C Offline
                      Chris Losinger
                      wrote on last edited by
                      #14

                      sounds like the kind of thing you'd get from a machine-ported app. i worked at a place that had some C code which did quadratic optimization. but nobody could make any sense of the C, because it had been machine-translated from FORTRAN - all the variables were "a", "b", "c", etc., and the code was full of GOTOs and statics. we eventually bought a C# implementation.

                      image processing toolkits | batch image processing

                      S 1 Reply Last reply
                      0
                      • P Paul Conrad

                        PIEBALDconsult wrote:

                        there could also be a % or $

                        I remember that. $ for strings, and % for integer if I recall correctly. Funny thing, I still have the old Commodore sitting in the eave/storage thingee, 10 feet away from this desk. Maybe I'll dig it out one of these days :)

                        "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                        Paul Conrad wrote:

                        % for integer

                        Right, but we all said, "Why would we ever want to use an integer? Reals will do whatever we need."

                        1 Reply Last reply
                        0
                        • C Chris Losinger

                          sounds like the kind of thing you'd get from a machine-ported app. i worked at a place that had some C code which did quadratic optimization. but nobody could make any sense of the C, because it had been machine-translated from FORTRAN - all the variables were "a", "b", "c", etc., and the code was full of GOTOs and statics. we eventually bought a C# implementation.

                          image processing toolkits | batch image processing

                          S Offline
                          S Offline
                          Steven A Lowe
                          wrote on last edited by
                          #16

                          sadyly, it was hand-written - I know the professor that wrote it. All of his programs are written that way. :((

                          Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

                          1 Reply Last reply
                          0
                          • R Rob Graham

                            When dealing with punch cards, short variable names are a blessing.

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

                            short variable names are always a blessing. :)

                            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
                            • P Paul Conrad

                              I don't recall what the limit was in the macro assembler, but in Commodore Basic it was only the first two characters counting.

                              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                              Well, here we have one big difference between interpreters and assemblers / compilers. An interpreter, like the good old BASIC, must hold the source in RAM, as well as every variable in use. On my old machine, it had only 4k for the interpreter AND the program AND the variables, it was the same: Better live with short variables and without comments than getting an out of memory error before the program is complete. In assembly programs or with a compiler this is no problem. Comments and variable names only make the source file longer, but both don't make it into the executable.

                              A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                              P 1 Reply Last reply
                              0
                              • P Paul Conrad

                                PIEBALDconsult wrote:

                                there could also be a % or $

                                I remember that. $ for strings, and % for integer if I recall correctly. Funny thing, I still have the old Commodore sitting in the eave/storage thingee, 10 feet away from this desk. Maybe I'll dig it out one of these days :)

                                "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                                Do it. It's fun to see the old machines going again. But also a bit scary, how primitive things were back then and how much we have been spoiled by the comfort of modern machines. Let's see, which one am I going to use tonight? The old Elf II? Atari 400? Or shall I take the Atari 800 XL? Or perhaps the 1040 ST? ....

                                A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                                P 1 Reply Last reply
                                0
                                • S Steven A Lowe

                                  a friend of mine - many years ago - was asked to port a physics simulation program from one platform to another. The software performed beautifully, was efficient, and had won awards for educational excellence etc. the source code was several thousand lines of assembly, which was large but not too large for that platform and era. The program had two comments in it, one word each. They were not helpful. The variable naming convention was even more interesting. It seems the original author [a physicist/mathematician, in all fairness] treated variable names like a Pez dispenser. The first variable in the program was named "A", the second was named "B", and so on. When he got to Z he started over with A1, then B1, etc. The program had a lot of variables, I think the last variable was named BB21. Porting the application was not too difficult, as the two platforms had very similar instruction sets. Debugging it, on the other hand, was an exercise in insanity!

                                  Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

                                  B Offline
                                  B Offline
                                  BillW33
                                  wrote on last edited by
                                  #20

                                  A place where I used to work had a lot of code with variable names like a, aa, b, bb, etc. Their reason? The time they saved by not typing out a longer variable name would add up to a significant time savings over the course of a year. They also saw nothing wrong with method names like "DoIt". You think that these things would make the code to understand? Their answer to that objection was "A good programmer can figure out what the code does!". I don't work there anymore, for obvious reasons ;).

                                  S 1 Reply Last reply
                                  0
                                  • L Lost User

                                    Well, here we have one big difference between interpreters and assemblers / compilers. An interpreter, like the good old BASIC, must hold the source in RAM, as well as every variable in use. On my old machine, it had only 4k for the interpreter AND the program AND the variables, it was the same: Better live with short variables and without comments than getting an out of memory error before the program is complete. In assembly programs or with a compiler this is no problem. Comments and variable names only make the source file longer, but both don't make it into the executable.

                                    A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                                    P Offline
                                    P Offline
                                    Paul Conrad
                                    wrote on last edited by
                                    #21

                                    CDP1802 wrote:

                                    we have one big difference between interpreters and assemblers / compilers.

                                    Oh yes, that was my first lesson in the difference between compilers and interpreters. Writing a program in the old Commodore Basic, then write the equivalent - sometimes by hand - in assembly, and what a bit of difference that was :) I did get my first Intel based machine as a high school graduation present, in 1991, an Intel 80386-DX25mhz box. I had qbasic and Microsoft Quick Basic 4.5 both installed on the machine. Bit of a performance difference between those two, back then.

                                    "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                                    L 1 Reply Last reply
                                    0
                                    • L Lost User

                                      Do it. It's fun to see the old machines going again. But also a bit scary, how primitive things were back then and how much we have been spoiled by the comfort of modern machines. Let's see, which one am I going to use tonight? The old Elf II? Atari 400? Or shall I take the Atari 800 XL? Or perhaps the 1040 ST? ....

                                      A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                                      P Offline
                                      P Offline
                                      Paul Conrad
                                      wrote on last edited by
                                      #22

                                      CDP1802 wrote:

                                      Do it. It's fun to see the old machines going again.

                                      I'm going to. Had a friend back in college write his own lynx-like browser for his C128. It was pretty cool.

                                      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                                      1 Reply Last reply
                                      0
                                      • S Steven A Lowe

                                        a friend of mine - many years ago - was asked to port a physics simulation program from one platform to another. The software performed beautifully, was efficient, and had won awards for educational excellence etc. the source code was several thousand lines of assembly, which was large but not too large for that platform and era. The program had two comments in it, one word each. They were not helpful. The variable naming convention was even more interesting. It seems the original author [a physicist/mathematician, in all fairness] treated variable names like a Pez dispenser. The first variable in the program was named "A", the second was named "B", and so on. When he got to Z he started over with A1, then B1, etc. The program had a lot of variables, I think the last variable was named BB21. Porting the application was not too difficult, as the two platforms had very similar instruction sets. Debugging it, on the other hand, was an exercise in insanity!

                                        Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

                                        V Offline
                                        V Offline
                                        Vasudevan Deepak Kumar
                                        wrote on last edited by
                                        #23

                                        Steven A. Lowe wrote:

                                        BB21

                                        Is he a fan(atic) and lunatic user of Microsoft Excel (spreadsheet program) which has this AA, BB type arrangements for its grid?

                                        Vasudevan Deepak Kumar Personal Homepage
                                        Tech Gossips
                                        All the world's a stage, And all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts... --William Shakespeare

                                        S 1 Reply Last reply
                                        0
                                        • C Chris Maunder

                                          I spent too much time dealing with numerical modelling suites written in FORTRAN written exactly the same way. Thousands and thousands of lines, and all the variables "x", "xx", "xxx" etc. Comments? We're physicists, not literary majors. We don't need no stinkin' comments. The code is obvious anyway... :doh: :sigh:

                                          cheers, Chris Maunder

                                          CodeProject.com : C++ MVP

                                          V Offline
                                          V Offline
                                          Vasudevan Deepak Kumar
                                          wrote on last edited by
                                          #24

                                          Actually, once the application is run through an obfuscator tool, the output code would be like this. Isn't it?

                                          Vasudevan Deepak Kumar Personal Homepage
                                          Tech Gossips
                                          All the world's a stage, And all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts... --William Shakespeare

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