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. Best Programming Advice Ever.

Best Programming Advice Ever.

Scheduled Pinned Locked Moved The Lounge
phpcomtoolsquestion
36 Posts 22 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.
  • D Dalek Dave

    that has been the advice since I was a sysop in the early 80's!

    ------------------------------------ "The greatest tragedy in mankind's entire history may be the hijacking of morality by religion" Arthur C Clarke

    Brian C HartB Offline
    Brian C HartB Offline
    Brian C Hart
    wrote on last edited by
    #5

    Yeah right like anybody does that LOL I have seen some doozies in my time. My favorite is one-letter variable names! Like

    StringArray a = new StringArray();

    Sincerely Yours, Brian Hart

    N 1 Reply Last reply
    0
    • J John M Drescher

      That's really in VC6?

      John

      L Offline
      L Offline
      Leslie Sanford
      wrote on last edited by
      #6

      John M. Drescher wrote:

      That's really in VC6?

      Heh, that was my first reaction, too.

      M 1 Reply Last reply
      0
      • L Leslie Sanford

        John M. Drescher wrote:

        That's really in VC6?

        Heh, that was my first reaction, too.

        M Offline
        M Offline
        Michael Schubert
        wrote on last edited by
        #7

        He added this to the "msdev.tip" file which is a plain text file. :-D

        P 1 Reply Last reply
        0
        • M Michael Schubert

          He added this to the "msdev.tip" file which is a plain text file. :-D

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

          Oooh, you can do that?

          1 Reply Last reply
          0
          • P Philip Laureano

            Clickety[^] :)

            Do you know...LinFu?

            R Offline
            R Offline
            Rei Miyasaka
            wrote on last edited by
            #9

            Actually the person maintaining my code is me -- a serial killer that knows where I live.

            1 Reply Last reply
            0
            • P Philip Laureano

              Clickety[^] :)

              Do you know...LinFu?

              F Offline
              F Offline
              frankie01000100
              wrote on last edited by
              #10

              IList newList = new List(); //I eat serial killers for breakfast newList.Add("word"); //You think you can take me? Think again a*shole

              1 Reply Last reply
              0
              • Brian C HartB Brian C Hart

                Yeah right like anybody does that LOL I have seen some doozies in my time. My favorite is one-letter variable names! Like

                StringArray a = new StringArray();

                Sincerely Yours, Brian Hart

                N Offline
                N Offline
                Naruki 0
                wrote on last edited by
                #11

                ... in the right circumstances. Pretty much being that the variable is in a very short scope and is basically a tmp variable, where the name is not important.

                Don't let my name fool you. That's my job.

                Brian C HartB D J 3 Replies Last reply
                0
                • C Colin Angus Mackay

                  It is scary the number of people that don't take that advice.

                  * Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay


                  Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

                  N Offline
                  N Offline
                  Naruki 0
                  wrote on last edited by
                  #12

                  We need to start scaring those people instead. Step 1: find out where they live Step 2: make them aware of that Step 3: ??? Step 4: Profit!

                  Don't let my name fool you. That's my job.

                  1 Reply Last reply
                  0
                  • P Philip Laureano

                    Clickety[^] :)

                    Do you know...LinFu?

                    S Offline
                    S Offline
                    Schmuli
                    wrote on last edited by
                    #13

                    The tip appears in the wrong place. It should be in the Visual Basic editor (at least, as well).

                    1 Reply Last reply
                    0
                    • N Naruki 0

                      ... in the right circumstances. Pretty much being that the variable is in a very short scope and is basically a tmp variable, where the name is not important.

                      Don't let my name fool you. That's my job.

                      Brian C HartB Offline
                      Brian C HartB Offline
                      Brian C Hart
                      wrote on last edited by
                      #14

                      That point is irrelevant. I am talking about seeing this in high performance scientfic codes where a single function can be thousands of lines long. Makes the code fairly hard to understand if all the tmp variables happen to be one letter, trust me.

                      Sincerely Yours, Brian Hart

                      K N D S 4 Replies Last reply
                      0
                      • Brian C HartB Brian C Hart

                        That point is irrelevant. I am talking about seeing this in high performance scientfic codes where a single function can be thousands of lines long. Makes the code fairly hard to understand if all the tmp variables happen to be one letter, trust me.

                        Sincerely Yours, Brian Hart

                        K Offline
                        K Offline
                        KungFuCoder
                        wrote on last edited by
                        #15

                        I just settle for calling them tmpStr tmpInt etc so I know. Tend not to use them at all unless I have to

                        N D 2 Replies Last reply
                        0
                        • Brian C HartB Brian C Hart

                          That point is irrelevant. I am talking about seeing this in high performance scientfic codes where a single function can be thousands of lines long. Makes the code fairly hard to understand if all the tmp variables happen to be one letter, trust me.

                          Sincerely Yours, Brian Hart

                          N Offline
                          N Offline
                          Naruki 0
                          wrote on last edited by
                          #16

                          That point is irrelevant. Typical phud, discrediting anything that disagrees. Heh. :) The point was absolutely relevant since you did not specify any conditions. In your new revision, I certainly agree - in fact, my original point already acknowledged that and more. I was just pointing out that your absolute statement was, with even a single counter-example, therefore absolutely wrong. As a programmer you gotta be careful with those corner cases.

                          Don't let my name fool you. That's my job.

                          1 Reply Last reply
                          0
                          • K KungFuCoder

                            I just settle for calling them tmpStr tmpInt etc so I know. Tend not to use them at all unless I have to

                            N Offline
                            N Offline
                            Naruki 0
                            wrote on last edited by
                            #17

                            My first thought was putting that in context with the idea of a 1000+ line function and thinking: well that's just gonna piss him off all over again. Might as well just call it thisVariableHasMoreThan1Letter or singleLetterVariablesSuck. But as a response to my point it does make sense. I do that, too, in most such situations. But not all.

                            1 Reply Last reply
                            0
                            • P Philip Laureano

                              Clickety[^] :)

                              Do you know...LinFu?

                              C Offline
                              C Offline
                              clearbrian1
                              wrote on last edited by
                              #18

                              Just do what apple do. Create a platform...IPOD/IPHONE They only change 3 things every 6 months..(Email forwarding (cmon we all know that took a day to write))..have a big macworld announcement and the starving clients will praise you forever. :) 6 bugs /year...think thats a programmers best average? :)

                              G 1 Reply Last reply
                              0
                              • N Naruki 0

                                ... in the right circumstances. Pretty much being that the variable is in a very short scope and is basically a tmp variable, where the name is not important.

                                Don't let my name fool you. That's my job.

                                D Offline
                                D Offline
                                Dave Parker
                                wrote on last edited by
                                #19

                                At the place where I used to work the guy who was there before me made *every* variable a global (this is in VB6) and would start with the name AAA and work his way upwards :-s

                                D 1 Reply Last reply
                                0
                                • D Dave Parker

                                  At the place where I used to work the guy who was there before me made *every* variable a global (this is in VB6) and would start with the name AAA and work his way upwards :-s

                                  D Offline
                                  D Offline
                                  destynova
                                  wrote on last edited by
                                  #20

                                  Dave Parker wrote:

                                  At the place where I used to work the guy who was there before me made *every* variable a global (this is in VB6) and would start with the name AAA and work his way upwards :-s

                                  Now that's a master coder.

                                  N 1 Reply Last reply
                                  0
                                  • K KungFuCoder

                                    I just settle for calling them tmpStr tmpInt etc so I know. Tend not to use them at all unless I have to

                                    D Offline
                                    D Offline
                                    destynova
                                    wrote on last edited by
                                    #21

                                    KungFuCoder wrote:

                                    I just settle for calling them tmpStr tmpInt etc so I know.

                                    It's better than nothing I suppose, unless you're using a statically typed language, in which case it's completely useless (e.g. "int tmpInt" is redundant and a waste of brain/finger time).

                                    N 1 Reply Last reply
                                    0
                                    • Brian C HartB Brian C Hart

                                      That point is irrelevant. I am talking about seeing this in high performance scientfic codes where a single function can be thousands of lines long. Makes the code fairly hard to understand if all the tmp variables happen to be one letter, trust me.

                                      Sincerely Yours, Brian Hart

                                      D Offline
                                      D Offline
                                      destynova
                                      wrote on last edited by
                                      #22

                                      Brian Hart wrote:

                                      That point is irrelevant. I am talking about seeing this in high performance scientfic codes where a single function can be thousands of lines long. Makes the code fairly hard to understand if all the tmp variables happen to be one letter, trust me.

                                      I'll tell you what makes the code fairly hard to understand: having a single function which is thousands of lines long. This is idiotic and completely unnecessary - we've had procedures and functions and other abstractions since before colour TV, and their main use is to prevent thousand line functions from ever existing. IMO, tiny variable names are okay if you have quite short functions, which you really should anyway.

                                      T 1 Reply Last reply
                                      0
                                      • N Naruki 0

                                        ... in the right circumstances. Pretty much being that the variable is in a very short scope and is basically a tmp variable, where the name is not important.

                                        Don't let my name fool you. That's my job.

                                        J Offline
                                        J Offline
                                        Jane Williams
                                        wrote on last edited by
                                        #23

                                        It did have positive benefits back in the early days of COBOL, punched cards, and things like that. Anything that saved memory was a good thing. You know, like 2-digit years.... hmmm... Yes, I have attempted to maintain programs from that era. Two-letter variable names and labels, many hundreds of gotos, even more hundred alter-gotos. Having done so, let me add something to that original advice. 2) If you use 1 or 2 letter variable names, do not leave your name in the comments at the top of the code to say what you did. 2a) Especially if one of the programmers who will read it, a few decades later, is your own daughter. She DOES know where you live.

                                        N 1 Reply Last reply
                                        0
                                        • Brian C HartB Brian C Hart

                                          That point is irrelevant. I am talking about seeing this in high performance scientfic codes where a single function can be thousands of lines long. Makes the code fairly hard to understand if all the tmp variables happen to be one letter, trust me.

                                          Sincerely Yours, Brian Hart

                                          S Offline
                                          S Offline
                                          supercat9
                                          wrote on last edited by
                                          #24

                                          I am talking about seeing this in high performance scientfic codes where a single function can be thousands of lines long. There is nothing wrong, IMHO, with using trivial variable names in cases where the scope of the variable is short and its meaning can be entirely gleaned from context. A classic example:

                                          For I As Integer = 1 To 40
                                          Item.Dat(I) = 0
                                          Next

                                          Would using any name other than "I" make things clearer? Of how about something like:

                                          Dim st As String
                                          st = GetSomeData();
                                          If Not String.IsNullOrEmpty(st) Then
                                          DoSomethingWith(st)
                                          Endif

                                          Would any name other than "st" be more helpful?

                                          N Brian C HartB 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