this (another C# programmer rant)
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
Yep. One of my favourite hates.
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
i am drinking this.coffee and feeling this.pain you have ;P reminds me of vb a lot...
----------------------------------------------------------- "When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
In vs2k3, intilisense didn't start as soon as you began typing. IF you weren't sure what the variable was called you had to type
this.
to make it come up. Not needed int 2k8, I never used 2k5; could just be an old bad habit.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
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
I've seen comments... probably here... from folk who use it to make it obvious they're using member variables (replacing the old
m_
prefix, essentially). I don't care for it either.----
You're right. These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets.
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
I'd be more concerned about the lack of a StringBuilder to be honest.
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
i use letters all the time for couters in a for loop, do you hate that?
for(int i = 0; i < this.k; i++){
MarcClifton.Anger++;
}Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer. -Fred Brooks
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
I do it just to piss people off. :-D
-
i use letters all the time for couters in a for loop, do you hate that?
for(int i = 0; i < this.k; i++){
MarcClifton.Anger++;
}Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer. -Fred Brooks
I think his complaint is that
this.k
could be easily written simply ask
. Although yes, k is a terrible name for a class member.----
You're right. These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets.
-
I'd be more concerned about the lack of a StringBuilder to be honest.
i was under the impression that using the "+" with stringbuilder would actually decrease performance? that you should use "append" ? in which case they should have both string builder and append.
----------------------------------------------------------- "When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
I hate it when people don't do this:). But it is more of a personal preference. The bottom line is to follow a set guideline throughout your project. For me,
data[i].ToString()
makes me feel pity about data. It seems as if he is orphan. When you prefix withthis.data
, I feel much happy about data, at least it has an object where it belongs to which takes its care.Proud to be a CPHog user
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
-
Agreed.
this
,Self
andMe
are keywords that serve no purpose.To those who understand, I extend my hand. To the doubtful I demand: Take me as I am. Not under your command, I know where I stand. I won't change to fit yout plan. Take me as I am.
They serve limited purpose, but rarely do any harm.
-
Agreed.
this
,Self
andMe
are keywords that serve no purpose.To those who understand, I extend my hand. To the doubtful I demand: Take me as I am. Not under your command, I know where I stand. I won't change to fit yout plan. Take me as I am.
leonej_dt wrote:
Agreed. this, Self and Me are keywords that serve no purpose.
I wouldn't go that far. I avoid 'this' like the plague as a general rule, but I'll still use it as a parameter to a function, for example. What's your alternative in that case?
-
leonej_dt wrote:
Agreed. this, Self and Me are keywords that serve no purpose.
I wouldn't go that far. I avoid 'this' like the plague as a general rule, but I'll still use it as a parameter to a function, for example. What's your alternative in that case?
-
I do it just to piss people off. :-D
PIEBALDconsult wrote:
I do it just to piss people off.
You're one step closer to "Outlaw" status.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
I would be more concern of naming a member variable "k". Why do you hate "this" so much?
-
Code:
public override string ToString() { string s = String.Empty; for (long i = 0; i < this.k; ++i) { s += this.data\[i\].ToString() + " "; } return s; } // ToString()
I HATE WHEN PROGRAMMERS USE THIS. this.k??? Give me a FB!!!! That doesn't even make sense from a "I'm saving keystrokes by prefixing with "this." so Intellisense kicks in." Marc
Almost certainly it's to kick in intellisense. I do it all the time; it's a form of insurance to gurantee you are typing the correct variable name. At worst it's a difference of esthetics, it makes no other difference.
"It's so simple to be wise. Just think of something stupid to say and then don't say it." -Sam Levenson
-
I think his complaint is that
this.k
could be easily written simply ask
. Although yes, k is a terrible name for a class member.----
You're right. These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets.
Shog9 wrote:
Although yes, k is a terrible name for a class member.
In the context of the class, it makes sense. Combinations(n, k), where "n" and "k" are the common math terms for these concepts. Marc
-
i use letters all the time for couters in a for loop, do you hate that?
for(int i = 0; i < this.k; i++){
MarcClifton.Anger++;
}Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer. -Fred Brooks
StevenWalsh wrote:
i use letters all the time for couters in a for loop, do you hate that?
I do that all the time. And I start with "i", harking back to the days of Fortran, where "i" was the first of several letters that defaulted to integer type. Pretty crazy. Marc