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. Other Discussions
  3. Clever Code
  4. Stack Overflow

Stack Overflow

Scheduled Pinned Locked Moved Clever Code
helpsysadmindata-structuresdebuggingtutorial
35 Posts 19 Posters 2 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.
  • E eggsovereasy

    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.

    N Offline
    N Offline
    Nemanja Trifunovic
    wrote on last edited by
    #3

    Properties are evil.


    Programming Blog utf8-cpp

    M 1 Reply Last reply
    0
    • E eggsovereasy

      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.

      Q Offline
      Q Offline
      QuiJohn
      wrote on last edited by
      #4

      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.

      L 1 Reply Last reply
      0
      • P Pete OHanlon

        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.

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #5

        Pete O'Hanlon wrote:

        use underscore to prefix fields

        Wow, I thought I was the only one left doing that. :cool:

        led mike

        F 1 Reply Last reply
        0
        • Q QuiJohn

          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.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #6

          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

          P Q 2 Replies Last reply
          0
          • L 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

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

            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.)

            1 Reply Last reply
            0
            • N Nemanja Trifunovic

              Properties are evil.


              Programming Blog utf8-cpp

              M Offline
              M Offline
              Matt Gerrans
              wrote on last edited by
              #8

              Properties are wonderful. I think Mr. Kentley has it right -- case sensitive languages are the problem.

              Matt Gerrans

              N R V 3 Replies Last reply
              0
              • M Matt Gerrans

                Properties are wonderful. I think Mr. Kentley has it right -- case sensitive languages are the problem.

                Matt Gerrans

                N Offline
                N Offline
                Nemanja Trifunovic
                wrote on last edited by
                #9

                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]


                Programming Blog utf8-cpp

                P 1 Reply Last reply
                0
                • N Nemanja Trifunovic

                  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]


                  Programming Blog utf8-cpp

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

                  " 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.

                  N 1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    " 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.

                    N Offline
                    N Offline
                    Nemanja Trifunovic
                    wrote on last edited by
                    #11

                    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.


                    Programming Blog utf8-cpp

                    M 1 Reply Last reply
                    0
                    • E eggsovereasy

                      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.

                      G Offline
                      G Offline
                      Guffa
                      wrote on last edited by
                      #12

                      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; }

                      C 1 Reply Last reply
                      0
                      • L 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

                        Q Offline
                        Q Offline
                        QuiJohn
                        wrote on last edited by
                        #13

                        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.

                        L 1 Reply Last reply
                        0
                        • Q QuiJohn

                          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.

                          L Offline
                          L Offline
                          led mike
                          wrote on last edited by
                          #14

                          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

                          P M 2 Replies Last reply
                          0
                          • G Guffa

                            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; }

                            C Offline
                            C Offline
                            Chris Meech
                            wrote on last edited by
                            #15

                            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]

                            G J 2 Replies Last reply
                            0
                            • C Chris Meech

                              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]

                              G Offline
                              G Offline
                              Guffa
                              wrote on last edited by
                              #16

                              I'm not that old, so I have only seen the cards in question, but the ones I have seen had a line where you wrote the code to be punched. I guess your's was a small company that didn't have any staff for doing that. ;)

                              --- b { font-weight: normal; }

                              1 Reply Last reply
                              0
                              • L led mike

                                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

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

                                " 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.

                                J 1 Reply Last reply
                                0
                                • P PIEBALDconsult

                                  " 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.

                                  J Offline
                                  J Offline
                                  Jorgen Sigvardsson
                                  wrote on last edited by
                                  #18

                                  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

                                  1 Reply Last reply
                                  0
                                  • C Chris Meech

                                    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]

                                    J Offline
                                    J Offline
                                    Jorgen Sigvardsson
                                    wrote on last edited by
                                    #19

                                    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

                                    1 Reply Last reply
                                    0
                                    • L led mike

                                      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

                                      M Offline
                                      M Offline
                                      Matt Gerrans
                                      wrote on last edited by
                                      #20

                                      See Straw Man Argument[^] under the topic "Logical Falacies."

                                      Matt Gerrans

                                      1 Reply Last reply
                                      0
                                      • N Nemanja Trifunovic

                                        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.


                                        Programming Blog utf8-cpp

                                        M Offline
                                        M Offline
                                        Matt Gerrans
                                        wrote on last edited by
                                        #21

                                        Maybe you should just avoid all languages that allow any sort of recursion. :laugh:

                                        Matt Gerrans

                                        N 1 Reply Last reply
                                        0
                                        • M Matt Gerrans

                                          Properties are wonderful. I think Mr. Kentley has it right -- case sensitive languages are the problem.

                                          Matt Gerrans

                                          R Offline
                                          R Offline
                                          Roger Alsing 0
                                          wrote on last edited by
                                          #22

                                          >>case sensitive languages are the problem No, sloppy coders are the problem. properties does not kill apps, people do.. ;-)

                                          P 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