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.
  • 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
                              • F Fernando A Gomez F

                                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 Offline
                                P Offline
                                Pierre Leclercq
                                wrote on last edited by
                                #35

                                I do this too (the m, l and p things). And even though camel case is widespread now, I find it too useful to drop it.

                                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