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.
  • 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
                  • M Matt Gerrans

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

                    Matt Gerrans

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

                    Matt Gerrans wrote:

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

                    No, I just avoid methods that look like data members ;P


                    Programming Blog utf8-cpp

                    M 1 Reply Last reply
                    0
                    • R Roger Alsing 0

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

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

                      They can have my properties when they pry them from my cold dead hands.

                      1 Reply Last reply
                      0
                      • N Nemanja Trifunovic

                        Matt Gerrans wrote:

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

                        No, I just avoid methods that look like data members ;P


                        Programming Blog utf8-cpp

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

                        I'll admit I've used case-sensitivity to distinguish fields from the properties that represent them. I've never had this recursion problem and it doesn't seem like a big issue. Seems like it should be easy to track down. I don't even think it is necessary to have some silly convention like junking up field names with an "_" or "m_" prefix (or even a "look_out_this_here_is_a_member_variable_and_the_other_one_is_a_property_reference_so_do_be_careful_" prefix). I had more troubles with unexpected recursion when overloading the comparision operator. That's where you discover a strange dichotomy between reference variables and operator overloading, in that operator overloading kind of lets you treat variables like they are values when they are really references. It works out okay in C++ because you really can do that, but in C# it is trickier.

                        Matt Gerrans

                        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.

                          V Offline
                          V Offline
                          Vikram A Punathambekar
                          wrote on last edited by
                          #26

                          I was not bitten by the same bug, but I started doing it a couple of months back. Reason? They're easier to spot. :)

                          Cheers, Vikram.


                          "Life isn't fair, and the world is full of unscrupulous characters. There are things worth fighting for, killing for and dying for, but it's a really small list. Chalk it up to experience, let it go, and move on to the next positive experience in your life." - Christopher Duncan.

                          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

                            V Offline
                            V Offline
                            Vasudevan Deepak Kumar
                            wrote on last edited by
                            #27

                            Properties (with appropriate gettors and settors) are excellent assets to the language. I would say case-sensitivity is also required. The good glue is a a good consistent programming standard (aka) coding standard which would make a cleaner reading of the code, finer debugging, elegant troubleshooting and expedited resolution to the problem.

                            Vasudevan Deepak Kumar Personal Homepage namespace LavanyaDeepak
                            Personal Weblog
                            The World of Deepak and Lavanya
                            Views and Reviews

                            N 1 Reply Last reply
                            0
                            • V Vasudevan Deepak Kumar

                              Properties (with appropriate gettors and settors) are excellent assets to the language. I would say case-sensitivity is also required. The good glue is a a good consistent programming standard (aka) coding standard which would make a cleaner reading of the code, finer debugging, elegant troubleshooting and expedited resolution to the problem.

                              Vasudevan Deepak Kumar Personal Homepage namespace LavanyaDeepak
                              Personal Weblog
                              The World of Deepak and Lavanya
                              Views and Reviews

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

                              Vasudevan Deepak Kumar wrote:

                              Properties (with appropriate gettors and settors) are excellent assets to the language.

                              How so?


                              Programming Blog utf8-cpp

                              P 1 Reply Last reply
                              0
                              • N Nemanja Trifunovic

                                Vasudevan Deepak Kumar wrote:

                                Properties (with appropriate gettors and settors) are excellent assets to the language.

                                How so?


                                Programming Blog utf8-cpp

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

                                Expressiveness.

                                1 Reply Last reply
                                0
                                • L led mike

                                  Pete O'Hanlon wrote:

                                  use underscore to prefix fields

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

                                  led mike

                                  F Offline
                                  F Offline
                                  Fernando A Gomez F
                                  wrote on last edited by
                                  #30

                                  Hehe, I'm still using m_ prefix in my code, for member variables. I got a fellow coworker who goes further and uses l_ prefix for local variables and p_ prefix for parameters... :doh:

                                  A polar bear is a bear whose coordinates has been changed in terms of sine and cosine. Blog Personal Site

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

                                    N Offline
                                    N Offline
                                    NormDroid
                                    wrote on last edited by
                                    #31

                                    Caught me out once or twice.

                                    We made the buttons on the screen look so good you'll want to lick them. Steve Jobs

                                    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.

                                      A Offline
                                      A Offline
                                      Antony M Kancidrowski
                                      wrote on last edited by
                                      #32

                                      Classic, it makes me think that it is about time the compiler warned you about this sort of tight recursion where there is no possible exit. :)

                                      Ant. I'm hard, yet soft.
                                      I'm coloured, yet clear.
                                      I'm fruity and sweet.
                                      I'm jelly, what am I? Muse on it further, I shall return!
                                      - David Walliams (Little Britain)

                                      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.

                                        J Offline
                                        J Offline
                                        jhwurmbach
                                        wrote on last edited by
                                        #33

                                        I even prefer the good old m_ prefix. MFC legacy.


                                        "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                                        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.

                                          L Offline
                                          L Offline
                                          Luis Alonso Ramos
                                          wrote on last edited by
                                          #34

                                          That has happened to me a couple of times. It's Intellisense/Visual Assist fault, for completing the statement when I mean something else! :-D

                                          Luis Alonso Ramos Intelectix Chihuahua, Mexico

                                          Not much here: My CP Blog!

                                          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