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. Old age shows its mark...

Old age shows its mark...

Scheduled Pinned Locked Moved The Lounge
designhelpquestioncareer
47 Posts 31 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.
  • J j snooze

    this style works for me. Its hip like texting acronyms now. You could use i d k instead or f y i. My personal favorite was back when I used VB Dim g as string... It made my programming style quite revealing.

    M Offline
    M Offline
    Mark_Wallace
    wrote on last edited by
    #26

    j snooze wrote:

    You could use i d k

    They would be good for WHILE loops, but not FOR -- because with FOR loops, you do k.

    I wanna be a eunuchs developer! Pass me a bread knife!

    1 Reply Last reply
    0
    • D DerekT P

      Some early BASIC versions allowed up to 26 numeric variables; i through m (?) were integers, everything else floating point. It's a reflection of the generosity of 26 variables that in practice most of us only ever needed i, j, k as integers; we really were spoiled for choice.

      K Offline
      K Offline
      kalberts
      wrote on last edited by
      #27

      My first BASIC experience was with 286 variables: A-Z, A0-A9, B0-B9, ... And 26 string variables: A$ to Z$. I never saw a BASIC so tiny that it had only 26 numeric variables - maybe it existed, but I doubt that any real world problems were solved with that compiler :-). Also, the first Basic compiler I worked with didn't distinguish between integer and float - that was quite common in the early Basic days. I believe that with the Univac 1100 mainframe series Basic, every variable was born as integer, but as soon as it was assigned a float literal value or the result of a non-integer expression, the type was changed on the fly. (So I think it really was an interpreter, not a compiler system.) No Fortran style implicit type by (first) letter.

      1 Reply Last reply
      0
      • M MKJCP

        I recall that in calculus we would use i, j and k as the iterator variables for summation operators. The exception seemed to be t when it was time but that was more physics applications than the pure math.

        K Offline
        K Offline
        kalberts
        wrote on last edited by
        #28

        And in the grey zone between math and physics: I spent my high school senior year in the US as an exchange student. The physics teacher in my Norwegian high school had stressed that one good reason for using 'v' as a symbol for speed and 'u' as a symbol for voltage is to make it simpler to do complex calcuations as "pure math" without being confused by any physical interpretation of the (partial) expressions. My US physics teacher stressed exact the opposite view: We use 'v' for velocity to make you concious of the meaning of this value within a complex formula! ... He was surprised that we did not use the initial letters of the Norwegian words for those concepts. How can you know what you are calculating, if you ignore the semantics? I do understand his reasoning, but it goes only so far. At some point, you must detach the calculations from the physical interpretation of each value. To take one example: In electronics, I learned to calculate filters, handling both the values and the units, and saw it coming out as a value in seconds (or more commonly: microseconds) describing the filter. I know how I got there, but it never got under my skin how the value ended up as a time. I cannot associate a filter with a time span, the way I can see what a car's speed or mass represents. I can only handle it by treating it as pure math, and learn that the resulting value comes out as microseconds, without grokking it.

        M 1 Reply Last reply
        0
        • K kalberts

          And in the grey zone between math and physics: I spent my high school senior year in the US as an exchange student. The physics teacher in my Norwegian high school had stressed that one good reason for using 'v' as a symbol for speed and 'u' as a symbol for voltage is to make it simpler to do complex calcuations as "pure math" without being confused by any physical interpretation of the (partial) expressions. My US physics teacher stressed exact the opposite view: We use 'v' for velocity to make you concious of the meaning of this value within a complex formula! ... He was surprised that we did not use the initial letters of the Norwegian words for those concepts. How can you know what you are calculating, if you ignore the semantics? I do understand his reasoning, but it goes only so far. At some point, you must detach the calculations from the physical interpretation of each value. To take one example: In electronics, I learned to calculate filters, handling both the values and the units, and saw it coming out as a value in seconds (or more commonly: microseconds) describing the filter. I know how I got there, but it never got under my skin how the value ended up as a time. I cannot associate a filter with a time span, the way I can see what a car's speed or mass represents. I can only handle it by treating it as pure math, and learn that the resulting value comes out as microseconds, without grokking it.

          M Offline
          M Offline
          MKJCP
          wrote on last edited by
          #29

          That takes me back to my year as an Electrical Engineering major. The math that would fall out of circuit diagrams was pretty intense. In the end though it felt like hocus-pocus and I couldn't relate so became a Mechanical Eng. major, then a physics major but somehow ended up as an actuary writing programs. "i" is still an oft used loop variable so long as interest rates are not in the context. "grok", haven't heard that in a while. :)

          1 Reply Last reply
          0
          • S stoneyowl2

            Okay, I was writing some code and noticed that I was using 'i','j', and 'k' for looping indices - it shook me that I still retained that habit. :doh: Then I thought: "Who cares? They do the job" :laugh:

            A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

            K Offline
            K Offline
            kalberts
            wrote on last edited by
            #30

            In the early 1980s I read an analysis of the time consumption of CDC (mainframe systems) compilers. One of them spent about 60% of the total running time on getting the next source file character to the tokenizer. In the 35+ years since then I have never learnt anything that could fully explain that figure; maybe they had no buffering at any level between the getc() and the pysical disk. That would be crazy, but how can you explain the observations in other ways? That compiler certainly cannot have spent much resources on, say, fancy optimizations! The claim has some substance. I worked with Tcl/Tk in the early days, when the source code was directly interpreted: If a loop was executed a million times, the same source code statements were tokenized and parsed a million times. Whitespace and comments were skipped over a million times. Symbols were looked up a million times. So there were preprocessors removing all comments and unneccessary whitespace, to make the code run significantly faster. Some of these preprocessors also replaced longer variable names with short ones, but due to the extremely dynamic nature of Tcl (you can build a character string at run time, and then execute it as a statement - if you build a string referring to a variable name, it wouldn't find the shorter name). When Tcl introduced bytecodes, speed increased by a significant factor. I have heard similar stories from other developers, using other interpreted languages, and sometimes they argue in favor of short names to speed up interpretation. Today, that is mostly an old myth that won't die: Bytecode compilation, or at least some sort of pre-processing, has become the norm in anything that is called "interpreted" languages. (With no pre-processing, they are commonly called "scripting" languages nowadays.)

            1 Reply Last reply
            0
            • S stoneyowl2

              Okay, I was writing some code and noticed that I was using 'i','j', and 'k' for looping indices - it shook me that I still retained that habit. :doh: Then I thought: "Who cares? They do the job" :laugh:

              A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

              B Offline
              B Offline
              Bruce Patin
              wrote on last edited by
              #31

              I have a degree in physics, where we used single letters for every variable, going to Greek for lack of letters, and i,j,k were universally used for counting in equations, usually corresponding to the three dimensions x,y,z. FORTRAN was used for scientific calculations and naturally adopted what scientists use.

              1 Reply Last reply
              0
              • S stoneyowl2

                Okay, I was writing some code and noticed that I was using 'i','j', and 'k' for looping indices - it shook me that I still retained that habit. :doh: Then I thought: "Who cares? They do the job" :laugh:

                A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

                O Offline
                O Offline
                Overtkill
                wrote on last edited by
                #32

                You mean this isn't the Commodore 64 Basic language thread? :)

                1 Reply Last reply
                0
                • L Lost User

                  well another memory muscle reason for many... before FORTRAN many learned BASIC (back in the day when a school would have 2 or 3 TRS-80 or similar computers, the first version (Model I with 4k RAM) only had single char variables A..Z. Later the Model II (with the massive 16k) allowed 2 letters AA..ZZ. anyhoo it was actually in the Programming Guide (probably inspired from FORTRAN) that suggested I, J, K, L... for "general" integers (in particular FOR loops), (also ref: I for iterator) S, T, U for general strings. "Important" variables used A, B, C (effectively the global variables) suggested sticking to single letters for compatibility with Model I. Some versions of FORTRAN also had that 2 letter limit. "That way you could better determine what any variable was for/about." mock it if you will, but given the naming limitations of the time at least some were already invested enough to come up with some common coding styles. - Nowadays i, j as iterators/offsets even makes appearances in mathematics, - when you see "for (i = 0; ..." you already know the intent (unless you or the programmer are idiot(s), and that's even if it's someone else's code. -- and inasmuch almost makes it better to keep using i, j ... unless you're some sort of purist 'style wanker' who says 'the code may be misunderstood' ..... (and let's face it: such comments are nearly always a reflection of the lack of abilities of the idiot quoting them).

                  C Offline
                  C Offline
                  Charles Programmer
                  wrote on last edited by
                  #33

                  For general strings I kind of like S T F U. :laugh: No offence intended, merely humor.

                  1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    Old FORTRAN habits die hard ... I do the same, but at least I have to declare them these days. Old FORTRAN programmers never die, they RETURN to caller

                    Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

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

                    Not just FORTRAN. We used i, j, and k for loop vars in all my C and C++ classes, too.

                    If you think 'goto' is evil, try writing an Assembly program without JMP.

                    OriginalGriffO 1 Reply Last reply
                    0
                    • S stoneyowl2

                      If the next guy (or me) can't figure out what the 'i', or 'j' or 'k' is used for, then the need to get a different job (or take a FORTRAN course!).

                      A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

                      S Offline
                      S Offline
                      Steven1218
                      wrote on last edited by
                      #35

                      It's funny how we pick up these habits along the way, going from one language to the next. I immediately knew you had programmed in Fortran at some point.

                      O 1 Reply Last reply
                      0
                      • T TNCaver

                        Not just FORTRAN. We used i, j, and k for loop vars in all my C and C++ classes, too.

                        If you think 'goto' is evil, try writing an Assembly program without JMP.

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

                        As I said earlier: The Lounge[^]

                        Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... 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

                        T 1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          As I said earlier: The Lounge[^]

                          Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                          T Offline
                          T Offline
                          TNCaver
                          wrote on last edited by
                          #37

                          Pardon the repetition. I don't always read every other comment before adding my own. TL;DR syndrome.

                          If you think 'goto' is evil, try writing an Assembly program without JMP.

                          OriginalGriffO 1 Reply Last reply
                          0
                          • T TNCaver

                            Pardon the repetition. I don't always read every other comment before adding my own. TL;DR syndrome.

                            If you think 'goto' is evil, try writing an Assembly program without JMP.

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

                            No problem: I thought of copy'n'paste but couldn't be arsed! :laugh:

                            Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... 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

                            T 1 Reply Last reply
                            0
                            • M Mycroft Holmes

                              I have never touched Fortran or Cobol and I use the same conventions, I have no idea where I picked it up from as I learnt to code on a commodore 64 and then from a SuperBase manual.

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

                              M Offline
                              M Offline
                              M chael Luna
                              wrote on last edited by
                              #39

                              I used the same conventions, I started with Basic and Pascal, then Delphi and VB

                              1 Reply Last reply
                              0
                              • S stoneyowl2

                                Okay, I was writing some code and noticed that I was using 'i','j', and 'k' for looping indices - it shook me that I still retained that habit. :doh: Then I thought: "Who cares? They do the job" :laugh:

                                A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

                                D Offline
                                D Offline
                                Dr Walt Fair PE
                                wrote on last edited by
                                #40

                                I do the same. FORTRAN habits still live on!

                                CQ de W5ALT

                                Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                                1 Reply Last reply
                                0
                                • OriginalGriffO OriginalGriff

                                  No problem: I thought of copy'n'paste but couldn't be arsed! :laugh:

                                  Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                                  T Offline
                                  T Offline
                                  TNCaver
                                  wrote on last edited by
                                  #41

                                  :laugh:

                                  If you think 'goto' is evil, try writing an Assembly program without JMP.

                                  1 Reply Last reply
                                  0
                                  • S Steven1218

                                    It's funny how we pick up these habits along the way, going from one language to the next. I immediately knew you had programmed in Fortran at some point.

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

                                    Or just about any other language.

                                    1 Reply Last reply
                                    0
                                    • S stoneyowl2

                                      Okay, I was writing some code and noticed that I was using 'i','j', and 'k' for looping indices - it shook me that I still retained that habit. :doh: Then I thought: "Who cares? They do the job" :laugh:

                                      A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

                                      D Offline
                                      D Offline
                                      Dr Walt Fair PE
                                      wrote on last edited by
                                      #43

                                      Yeah, I spent Jan1 to Jan25 in the hospital due to an infection that left me too weak to stand up. Hopefully, I got all of the drama out of the way for the rest of the year.

                                      CQ de W5ALT

                                      Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                                      1 Reply Last reply
                                      0
                                      • S stoneyowl2

                                        If the next guy (or me) can't figure out what the 'i', or 'j' or 'k' is used for, then the need to get a different job (or take a FORTRAN course!).

                                        A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

                                        J Offline
                                        J Offline
                                        JohnnyCee
                                        wrote on last edited by
                                        #44

                                        They shouldn't have to figure it out. We aren't coding on punch cards where short variable names help programmer efficiency. Also, for most projects, triply-nested loops are a code smell and the method should be refactored.

                                        JohnnyCee

                                        J 1 Reply Last reply
                                        0
                                        • J JohnnyCee

                                          They shouldn't have to figure it out. We aren't coding on punch cards where short variable names help programmer efficiency. Also, for most projects, triply-nested loops are a code smell and the method should be refactored.

                                          JohnnyCee

                                          J Offline
                                          J Offline
                                          jschell
                                          wrote on last edited by
                                          #45

                                          Errr...are claiming that a programmer that sees the first rather than the second is going to somehow be better off? for(int index=0; index < 10; index++) for(int i=0; i < 10; i++)

                                          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