Best Programming Advice Ever.
-
That's really in VC6?
John
-
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
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
-
That's really in VC6?
John
John M. Drescher wrote:
That's really in VC6?
Heh, that was my first reaction, too.
-
John M. Drescher wrote:
That's really in VC6?
Heh, that was my first reaction, too.
He added this to the "msdev.tip" file which is a plain text file. :-D
-
He added this to the "msdev.tip" file which is a plain text file. :-D
Oooh, you can do that?
-
Actually the person maintaining my code is me -- a serial killer that knows where I live.
-
IList newList = new List(); //I eat serial killers for breakfast newList.Add("word"); //You think you can take me? Think again a*shole
-
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
-
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.
-
-
... 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.
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
-
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
I just settle for calling them tmpStr tmpInt etc so I know. Tend not to use them at all unless I have to
-
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
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.
-
I just settle for calling them tmpStr tmpInt etc so I know. Tend not to use them at all unless I have to
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.
-
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? :)
-
... 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.
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
-
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
-
I just settle for calling them tmpStr tmpInt etc so I know. Tend not to use them at all unless I have to
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).
-
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
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.
-
... 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.
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.