Stack Overflow
-
I had a problem with a web application killing the dev server built in to VS2005 with stack overflow errors and I couldn't find the problem. I went so far as finding every for, foreach, and while loop and putting a counter in them that would throw an exception with the method name in the message if it looped over 1000 times (which none of the loops should do in this app). The problem all came down to one capitalization error that I didn't see even though I went step by step through execution with the debugger...
public string Name
{
get { return this.Name; }
}
private string name;Obviously the "this.Name" in the property should be "this.name". I felt like a moron when it was over.
-
I had a problem with a web application killing the dev server built in to VS2005 with stack overflow errors and I couldn't find the problem. I went so far as finding every for, foreach, and while loop and putting a counter in them that would throw an exception with the method name in the message if it looped over 1000 times (which none of the loops should do in this app). The problem all came down to one capitalization error that I didn't see even though I went step by step through execution with the debugger...
public string Name
{
get { return this.Name; }
}
private string name;Obviously the "this.Name" in the property should be "this.name". I felt like a moron when it was over.
This is one of the reasons that I use underscore to prefix fields. They make it so much easier to spot.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.
-
I had a problem with a web application killing the dev server built in to VS2005 with stack overflow errors and I couldn't find the problem. I went so far as finding every for, foreach, and while loop and putting a counter in them that would throw an exception with the method name in the message if it looped over 1000 times (which none of the loops should do in this app). The problem all came down to one capitalization error that I didn't see even though I went step by step through execution with the debugger...
public string Name
{
get { return this.Name; }
}
private string name;Obviously the "this.Name" in the property should be "this.name". I felt like a moron when it was over.
-
I had a problem with a web application killing the dev server built in to VS2005 with stack overflow errors and I couldn't find the problem. I went so far as finding every for, foreach, and while loop and putting a counter in them that would throw an exception with the method name in the message if it looped over 1000 times (which none of the loops should do in this app). The problem all came down to one capitalization error that I didn't see even though I went step by step through execution with the debugger...
public string Name
{
get { return this.Name; }
}
private string name;Obviously the "this.Name" in the property should be "this.name". I felt like a moron when it was over.
Yet more evidence that having case sensitivity in any language or OS was a colossal mistake. I also believe that any developer "taking advantage" of this by having variable/property names vary only by capitalization is also making a big mistake, and is begging for errors exactly as demonstrated here. I have yet to hear a compelling argument against my stance.
-
This is one of the reasons that I use underscore to prefix fields. They make it so much easier to spot.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.
-
Yet more evidence that having case sensitivity in any language or OS was a colossal mistake. I also believe that any developer "taking advantage" of this by having variable/property names vary only by capitalization is also making a big mistake, and is begging for errors exactly as demonstrated here. I have yet to hear a compelling argument against my stance.
David Kentley wrote:
I have yet to hear a compelling argument against my stance.
Which one?
David Kentley wrote:
case sensitivity in any language or OS was a colossal mistake.
Disagree. Readability. Nothing worse than reading VB where the author changes case but is referring to the same entity. Well there are plenty of things worse than that like Iraq but you get the idea.
David Kentley wrote:
having variable/property names vary only by capitalization is also making a big mistake
Yes any name. Even by one character is not advisable. CMyClass and CMyClassa
led mike
-
David Kentley wrote:
I have yet to hear a compelling argument against my stance.
Which one?
David Kentley wrote:
case sensitivity in any language or OS was a colossal mistake.
Disagree. Readability. Nothing worse than reading VB where the author changes case but is referring to the same entity. Well there are plenty of things worse than that like Iraq but you get the idea.
David Kentley wrote:
having variable/property names vary only by capitalization is also making a big mistake
Yes any name. Even by one character is not advisable. CMyClass and CMyClassa
led mike
David Kentley wrote: case sensitivity in any language or OS was a colossal mistake. My general stance is: "Nothing in a user interface should be case-sensitive." (Nor should SPACEs be allowed in file names and such, but that's another whole kettle of eels.) David Kentley wrote: I have yet to hear a compelling argument against my stance. Me neither, the only argument in favor of having a case-sensitive UI I've ever heard is: "That way we can have more different command-line switches." My counter argument is: "You mean more one-character command-line switches, and one-character command-line switches are evil." (My background is in OpenVMS.)
-
Properties are wonderful. I think Mr. Kentley has it right -- case sensitive languages are the problem.
Matt Gerrans
-
Properties are wonderful. I think Mr. Kentley has it right -- case sensitive languages are the problem.
Matt Gerrans
Matt Gerrans wrote:
Properties are wonderful.
Then, we'll agree to dissagree :) In my book, something that is really a method should look like a method, not like a member variable.
Matt Gerrans wrote:
I think Mr. Kentley has it right -- case sensitive languages are the problem.
Almost all modern langauges are case sensitive, like it or not. Better get used to it, or you'll get burned when you start using dynamic languages like JavaScript, Python, Ruby... there will be no static type system to protect you. [EDIT]Based on your profile, you are already used to it :)[/EDIT]
-
Matt Gerrans wrote:
Properties are wonderful.
Then, we'll agree to dissagree :) In my book, something that is really a method should look like a method, not like a member variable.
Matt Gerrans wrote:
I think Mr. Kentley has it right -- case sensitive languages are the problem.
Almost all modern langauges are case sensitive, like it or not. Better get used to it, or you'll get burned when you start using dynamic languages like JavaScript, Python, Ruby... there will be no static type system to protect you. [EDIT]Based on your profile, you are already used to it :)[/EDIT]
" Then, we'll agree to dissagree In my book, something that is really a method should look like a method, not like a member variable. " Not at all, detail hiding is a basic OOP principle.
-
" Then, we'll agree to dissagree In my book, something that is really a method should look like a method, not like a member variable. " Not at all, detail hiding is a basic OOP principle.
PIEBALDconsult wrote:
detail hiding is a basic OOP principle.
:) Sure, as long as the "details" are not hidden so well that you mix them up and end up with a stack overflow.
-
I had a problem with a web application killing the dev server built in to VS2005 with stack overflow errors and I couldn't find the problem. I went so far as finding every for, foreach, and while loop and putting a counter in them that would throw an exception with the method name in the message if it looped over 1000 times (which none of the loops should do in this app). The problem all came down to one capitalization error that I didn't see even though I went step by step through execution with the debugger...
public string Name
{
get { return this.Name; }
}
private string name;Obviously the "this.Name" in the property should be "this.name". I felt like a moron when it was over.
Been there, done that. :) It's strange how people immediately blame the use of properties, or the case sensetivity of the language. It's like everyone is running around with a protest sign, just looking for a good spot where they can stand and wave it... ;) I have used the wrong name just like this a few times, and every time it was because I was using intellisense and chose the wrong item. Is the conclusion then that intellisense should be banned? Of course not. If everything in a programming environment that could possible be used in the wrong way should be removed, then we'd be back at writing code on punch cards...
--- b { font-weight: normal; }
-
David Kentley wrote:
I have yet to hear a compelling argument against my stance.
Which one?
David Kentley wrote:
case sensitivity in any language or OS was a colossal mistake.
Disagree. Readability. Nothing worse than reading VB where the author changes case but is referring to the same entity. Well there are plenty of things worse than that like Iraq but you get the idea.
David Kentley wrote:
having variable/property names vary only by capitalization is also making a big mistake
Yes any name. Even by one character is not advisable. CMyClass and CMyClassa
led mike
led mike wrote:
Disagree. Readability. Nothing worse than reading VB where the author changes case but is referring to the same entity.
I believe the only reason this is a problem is because you are used to case sensitivity in other languages. I agree that it would be bad style to change capitalization all over, and maybe some pseudo case sensitivity would be ok (i.e. the compiler would complain if a variable defined as theVariable was referenced as TheVariable, but wouldn't allow both names to be declared).
led mike wrote:
Well there are plenty of things worse than that like Iraq but you get the idea.
Well, just think, if Steve Jobs ran Iraq it would be called iRaq.
-
led mike wrote:
Disagree. Readability. Nothing worse than reading VB where the author changes case but is referring to the same entity.
I believe the only reason this is a problem is because you are used to case sensitivity in other languages. I agree that it would be bad style to change capitalization all over, and maybe some pseudo case sensitivity would be ok (i.e. the compiler would complain if a variable defined as theVariable was referenced as TheVariable, but wouldn't allow both names to be declared).
led mike wrote:
Well there are plenty of things worse than that like Iraq but you get the idea.
Well, just think, if Steve Jobs ran Iraq it would be called iRaq.
David Kentley wrote:
I believe the only reason this is a problem is because you are used to case sensitivity in other languages.
Not the only reason. It is also considered bad writing to mix cases. Ask an English Major. This must be at least partially a "readability" issue and we are not even talking "code" at that point. Also all caps are difficult to read because we process the character hights and read faster. All caps slow down that process by eliminating hight variation. This indicates that consistency is optimal to readability. tRy ReadIng soMthiNg lIKe thIS aLLDaY LOnG aND sEe hOW yoU LiKE IT! With something as specific as "code" I think the problem is increased. Therefore I am sticking to the "readability" issue as supporting case-sensitive languages.
led mike
-
Been there, done that. :) It's strange how people immediately blame the use of properties, or the case sensetivity of the language. It's like everyone is running around with a protest sign, just looking for a good spot where they can stand and wave it... ;) I have used the wrong name just like this a few times, and every time it was because I was using intellisense and chose the wrong item. Is the conclusion then that intellisense should be banned? Of course not. If everything in a programming environment that could possible be used in the wrong way should be removed, then we'd be back at writing code on punch cards...
--- b { font-weight: normal; }
Guffa wrote:
then we'd be back at writing code on punch cards...
Actually, we didn't write anything. We used typewriters of sorts, that really did punch holes in the cards. Beat the crap out of playing with all those toggle buttons, though. :-D
Chris Meech I am Canadian. [heard in a local bar] Nobody likes jerks. [espeir] Hey, I am part of a special bread, we are called smart people [Captain See Sharp] The zen of the soapbox is hard to attain...[Jörgen Sigvardsson] I wish I could remember what it was like to only have a short term memory.[David Kentley]
-
Guffa wrote:
then we'd be back at writing code on punch cards...
Actually, we didn't write anything. We used typewriters of sorts, that really did punch holes in the cards. Beat the crap out of playing with all those toggle buttons, though. :-D
Chris Meech I am Canadian. [heard in a local bar] Nobody likes jerks. [espeir] Hey, I am part of a special bread, we are called smart people [Captain See Sharp] The zen of the soapbox is hard to attain...[Jörgen Sigvardsson] I wish I could remember what it was like to only have a short term memory.[David Kentley]
-
David Kentley wrote:
I believe the only reason this is a problem is because you are used to case sensitivity in other languages.
Not the only reason. It is also considered bad writing to mix cases. Ask an English Major. This must be at least partially a "readability" issue and we are not even talking "code" at that point. Also all caps are difficult to read because we process the character hights and read faster. All caps slow down that process by eliminating hight variation. This indicates that consistency is optimal to readability. tRy ReadIng soMthiNg lIKe thIS aLLDaY LOnG aND sEe hOW yoU LiKE IT! With something as specific as "code" I think the problem is increased. Therefore I am sticking to the "readability" issue as supporting case-sensitive languages.
led mike
" It is also considered bad writing to mix cases. Ask an English Major. " Ah, but what about German? " Therefore I am sticking to the "readability" issue as supporting case-sensitive languages. " May be good style, but no reason for the language to enforce it.
-
" It is also considered bad writing to mix cases. Ask an English Major. " Ah, but what about German? " Therefore I am sticking to the "readability" issue as supporting case-sensitive languages. " May be good style, but no reason for the language to enforce it.
PIEBALDconsult wrote:
Ah, but what about German?
In German, only the first word of a sentence, nouns and names are given upper case (might be a few other cases (no pun intended)). The Upper Cases Are Not All Over The SentenceS. :)
PIEBALDconsult wrote:
May be good style, but no reason for the language to enforce it.
If the language doesn't, some project manager will through coding standards. What I'd like are non-ascii characters in programming languages. That would be far more usable than case insensitiveness.
-- A Stern Warning of Things to Come
-
Guffa wrote:
then we'd be back at writing code on punch cards...
Actually, we didn't write anything. We used typewriters of sorts, that really did punch holes in the cards. Beat the crap out of playing with all those toggle buttons, though. :-D
Chris Meech I am Canadian. [heard in a local bar] Nobody likes jerks. [espeir] Hey, I am part of a special bread, we are called smart people [Captain See Sharp] The zen of the soapbox is hard to attain...[Jörgen Sigvardsson] I wish I could remember what it was like to only have a short term memory.[David Kentley]
You know what a fun project would be? Build a card reader and a virtual machine, which you'd program with those cards...
-- In Hypno-Vision
-
David Kentley wrote:
I believe the only reason this is a problem is because you are used to case sensitivity in other languages.
Not the only reason. It is also considered bad writing to mix cases. Ask an English Major. This must be at least partially a "readability" issue and we are not even talking "code" at that point. Also all caps are difficult to read because we process the character hights and read faster. All caps slow down that process by eliminating hight variation. This indicates that consistency is optimal to readability. tRy ReadIng soMthiNg lIKe thIS aLLDaY LOnG aND sEe hOW yoU LiKE IT! With something as specific as "code" I think the problem is increased. Therefore I am sticking to the "readability" issue as supporting case-sensitive languages.
led mike
See Straw Man Argument[^] under the topic "Logical Falacies."
Matt Gerrans