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. The classic Case bug

The classic Case bug

Scheduled Pinned Locked Moved Clever Code
c++comarchitecturehelp
29 Posts 15 Posters 29 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.
  • C Chris Maunder

    public MyClass
    {
    public int IsUpdate { get... set...}

    ...

    public MyClass(int id, ..., bool isUpdate)
    {
    _id = id;
    ...
    _isUpdate = IsUpdate;
    }
    }

    You'd think by now I'd be able to spot these by now...

    cheers, Chris Maunder

    CodeProject.com : C++ MVP

    L Offline
    L Offline
    leppie
    wrote on last edited by
    #2

    The compiler error should be the first hint ;P On 2nd thought, I thought those were the new C# 3.0 auto properties, but then I noticed the ... :-O

    xacc.ide - now with TabsToSpaces support
    IronScheme - 1.0 alpha 4a out now (29 May 2008)

    1 Reply Last reply
    0
    • C Chris Maunder

      public MyClass
      {
      public int IsUpdate { get... set...}

      ...

      public MyClass(int id, ..., bool isUpdate)
      {
      _id = id;
      ...
      _isUpdate = IsUpdate;
      }
      }

      You'd think by now I'd be able to spot these by now...

      cheers, Chris Maunder

      CodeProject.com : C++ MVP

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #3

      Chris Maunder wrote:

      be able to spot these by now...

      Baaah, my eyes are tired right now :-O

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

      1 Reply Last reply
      0
      • C Chris Maunder

        public MyClass
        {
        public int IsUpdate { get... set...}

        ...

        public MyClass(int id, ..., bool isUpdate)
        {
        _id = id;
        ...
        _isUpdate = IsUpdate;
        }
        }

        You'd think by now I'd be able to spot these by now...

        cheers, Chris Maunder

        CodeProject.com : C++ MVP

        O Offline
        O Offline
        Optimus Chaos
        wrote on last edited by
        #4

        Yup, this one is a real classic ;)

        1 Reply Last reply
        0
        • C Chris Maunder

          public MyClass
          {
          public int IsUpdate { get... set...}

          ...

          public MyClass(int id, ..., bool isUpdate)
          {
          _id = id;
          ...
          _isUpdate = IsUpdate;
          }
          }

          You'd think by now I'd be able to spot these by now...

          cheers, Chris Maunder

          CodeProject.com : C++ MVP

          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #5

          What says the compiler/linker to this? :confused: ...maybe it is a feature... :-O

          Greetings from Germany

          1 Reply Last reply
          0
          • C Chris Maunder

            public MyClass
            {
            public int IsUpdate { get... set...}

            ...

            public MyClass(int id, ..., bool isUpdate)
            {
            _id = id;
            ...
            _isUpdate = IsUpdate;
            }
            }

            You'd think by now I'd be able to spot these by now...

            cheers, Chris Maunder

            CodeProject.com : C++ MVP

            J Offline
            J Offline
            Jan C de Graaf
            wrote on last edited by
            #6

            And that's why I like (against general popularity) the following notation:

            public MyClass(int p_intID, ..., bool p_blnIsUpdate)

            1 Reply Last reply
            0
            • C Chris Maunder

              public MyClass
              {
              public int IsUpdate { get... set...}

              ...

              public MyClass(int id, ..., bool isUpdate)
              {
              _id = id;
              ...
              _isUpdate = IsUpdate;
              }
              }

              You'd think by now I'd be able to spot these by now...

              cheers, Chris Maunder

              CodeProject.com : C++ MVP

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

              Have I mentioned that properties are evil?

              Programming Blog utf8-cpp

              C 1 Reply Last reply
              0
              • C Chris Maunder

                public MyClass
                {
                public int IsUpdate { get... set...}

                ...

                public MyClass(int id, ..., bool isUpdate)
                {
                _id = id;
                ...
                _isUpdate = IsUpdate;
                }
                }

                You'd think by now I'd be able to spot these by now...

                cheers, Chris Maunder

                CodeProject.com : C++ MVP

                J Offline
                J Offline
                J a a n s
                wrote on last edited by
                #8

                Stack overflow exception :confused: I need to increase the ram...;P

                *jaans

                1 Reply Last reply
                0
                • C Chris Maunder

                  public MyClass
                  {
                  public int IsUpdate { get... set...}

                  ...

                  public MyClass(int id, ..., bool isUpdate)
                  {
                  _id = id;
                  ...
                  _isUpdate = IsUpdate;
                  }
                  }

                  You'd think by now I'd be able to spot these by now...

                  cheers, Chris Maunder

                  CodeProject.com : C++ MVP

                  V Offline
                  V Offline
                  V 0
                  wrote on last edited by
                  #9

                  That's why I very rarely put capitals in my variable naming... ;P

                  V.
                  Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                  C 1 Reply Last reply
                  0
                  • V V 0

                    That's why I very rarely put capitals in my variable naming... ;P

                    V.
                    Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                    C Offline
                    C Offline
                    ChandraRam
                    wrote on last edited by
                    #10

                    V. wrote:

                    That's why I very rarely put capitals in my variable naming...

                    whatifyouneedareallylongvariablenamethen ;P :)

                    V 1 Reply Last reply
                    0
                    • N Nemanja Trifunovic

                      Have I mentioned that properties are evil?

                      Programming Blog utf8-cpp

                      C Offline
                      C Offline
                      Chris Maunder
                      wrote on last edited by
                      #11

                      :confused:

                      cheers, Chris Maunder

                      CodeProject.com : C++ MVP

                      P N 2 Replies Last reply
                      0
                      • C ChandraRam

                        V. wrote:

                        That's why I very rarely put capitals in my variable naming...

                        whatifyouneedareallylongvariablenamethen ;P :)

                        V Offline
                        V Offline
                        V 0
                        wrote on last edited by
                        #12

                        what_if_you_need_a_really_long_variable_name_then or wiynarlvnt fact is it always worked for me ;-)

                        V.
                        Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                        L 1 Reply Last reply
                        0
                        • C Chris Maunder

                          :confused:

                          cheers, Chris Maunder

                          CodeProject.com : C++ MVP

                          P Offline
                          P Offline
                          Paul Conrad
                          wrote on last edited by
                          #13

                          My thoughts, too.

                          "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                          1 Reply Last reply
                          0
                          • C Chris Maunder

                            :confused:

                            cheers, Chris Maunder

                            CodeProject.com : C++ MVP

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

                            If you invoke a function call with a syntax for accessing a variable, sooner or later you will invoke a function when you really wanted to access a variable.

                            Programming Blog utf8-cpp

                            C 1 Reply Last reply
                            0
                            • N Nemanja Trifunovic

                              If you invoke a function call with a syntax for accessing a variable, sooner or later you will invoke a function when you really wanted to access a variable.

                              Programming Blog utf8-cpp

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

                              I find that a terrible justification. Write your properties correctly and safely and without side effects and use properties instead of variables and you will not only be fine, but you will also have provided yourself that little bit of future proofing that Properties provide.

                              cheers, Chris Maunder

                              CodeProject.com : C++ MVP

                              N 1 Reply Last reply
                              0
                              • C Chris Maunder

                                I find that a terrible justification. Write your properties correctly and safely and without side effects and use properties instead of variables and you will not only be fine, but you will also have provided yourself that little bit of future proofing that Properties provide.

                                cheers, Chris Maunder

                                CodeProject.com : C++ MVP

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

                                Chris Maunder wrote:

                                Write your properties correctly and safely and without side effects and use properties instead of variables and you will not only be fine, but you will also have provided yourself that little bit of future proofing that Properties provide.

                                I don't write public variables (except for POD types). What I am arguing here is that the function syntax is much better for something that is really a function. Ie, I find much easier to understand this:

                                dialog.SetFont(font);

                                than:

                                dialog.Font = font; // looks like accessing a public variable, when it is really a function call

                                Not to mention all these cases when you try to set a member variable internaly, mix the case and get a stack overflow :rolleyes:

                                Programming Blog utf8-cpp

                                M P 2 Replies Last reply
                                0
                                • N Nemanja Trifunovic

                                  Chris Maunder wrote:

                                  Write your properties correctly and safely and without side effects and use properties instead of variables and you will not only be fine, but you will also have provided yourself that little bit of future proofing that Properties provide.

                                  I don't write public variables (except for POD types). What I am arguing here is that the function syntax is much better for something that is really a function. Ie, I find much easier to understand this:

                                  dialog.SetFont(font);

                                  than:

                                  dialog.Font = font; // looks like accessing a public variable, when it is really a function call

                                  Not to mention all these cases when you try to set a member variable internaly, mix the case and get a stack overflow :rolleyes:

                                  Programming Blog utf8-cpp

                                  M Offline
                                  M Offline
                                  Mladen Jankovic
                                  wrote on last edited by
                                  #17

                                  Nemanja Trifunovic wrote:

                                  Not to mention all these cases when you try to set a member variable internaly, mix the case and get a stack overflow

                                  Maybe different naming convention is better solution then avoidance of properties. With the significant code base it's not possible to change it, but then again it's your (or somebody else's) mistake made at the beginning of the project and not the fault of properties.

                                  Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they're sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. (Charles M Strauss)

                                  N 1 Reply Last reply
                                  0
                                  • M Mladen Jankovic

                                    Nemanja Trifunovic wrote:

                                    Not to mention all these cases when you try to set a member variable internaly, mix the case and get a stack overflow

                                    Maybe different naming convention is better solution then avoidance of properties. With the significant code base it's not possible to change it, but then again it's your (or somebody else's) mistake made at the beginning of the project and not the fault of properties.

                                    Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they're sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. (Charles M Strauss)

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

                                    Mladen Jankovic wrote:

                                    then again it's your (or somebody else's) mistake made at the beginning of the project and not the fault of properties.

                                    Sure. All I am saying is that properties are "too much abstraction" and easily add confusion. If something is a function, it should be invoked as a function, IMHO. Uzgred, cestitam na proslomesecnom clanku :)

                                    Programming Blog utf8-cpp

                                    M 1 Reply Last reply
                                    0
                                    • N Nemanja Trifunovic

                                      Chris Maunder wrote:

                                      Write your properties correctly and safely and without side effects and use properties instead of variables and you will not only be fine, but you will also have provided yourself that little bit of future proofing that Properties provide.

                                      I don't write public variables (except for POD types). What I am arguing here is that the function syntax is much better for something that is really a function. Ie, I find much easier to understand this:

                                      dialog.SetFont(font);

                                      than:

                                      dialog.Font = font; // looks like accessing a public variable, when it is really a function call

                                      Not to mention all these cases when you try to set a member variable internaly, mix the case and get a stack overflow :rolleyes:

                                      Programming Blog utf8-cpp

                                      P Offline
                                      P Offline
                                      peterchen
                                      wrote on last edited by
                                      #19

                                      Because coding doesn't end after a single SetFont statement. First, because I have to do that thousand times over and over, until a project is done. Because in a lengthy expression, every additional set of parantheses hurts readability. q = v.Mag*complex(cos(v.Phase),-sin(v.Phase))/c.Ref is closer to the problem domain description than SetQ(v.GetMag()*complex(cos(v.GetPhase(),-sin(v.Phase())/c.GetRef()) (I assume you agree that being close to the problem domain is a good thing)

                                      We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                                      blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                                      N 1 Reply Last reply
                                      0
                                      • N Nemanja Trifunovic

                                        Mladen Jankovic wrote:

                                        then again it's your (or somebody else's) mistake made at the beginning of the project and not the fault of properties.

                                        Sure. All I am saying is that properties are "too much abstraction" and easily add confusion. If something is a function, it should be invoked as a function, IMHO. Uzgred, cestitam na proslomesecnom clanku :)

                                        Programming Blog utf8-cpp

                                        M Offline
                                        M Offline
                                        Mladen Jankovic
                                        wrote on last edited by
                                        #20

                                        Nemanja Trifunovic wrote:

                                        Uzgred, cestitam na proslomesecnom clanku

                                        Hvala! :beer:

                                        Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they're sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. (Charles M Strauss)

                                        1 Reply Last reply
                                        0
                                        • P peterchen

                                          Because coding doesn't end after a single SetFont statement. First, because I have to do that thousand times over and over, until a project is done. Because in a lengthy expression, every additional set of parantheses hurts readability. q = v.Mag*complex(cos(v.Phase),-sin(v.Phase))/c.Ref is closer to the problem domain description than SetQ(v.GetMag()*complex(cos(v.GetPhase(),-sin(v.Phase())/c.GetRef()) (I assume you agree that being close to the problem domain is a good thing)

                                          We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                                          blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

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

                                          peterchen wrote:

                                          I assume you agree that being close to the problem domain is a good thing

                                          I agree. However, I am not sure I agree that additional parenthses move you away from the problem domain. In fact, your example just illustrates well what I mean by "too much abstraction". v.Phase does not look as a function call, and yet it is, and there are no restrictions what can happen within that function and how long it may take. That's my main problem with the properties.

                                          Programming Blog utf8-cpp

                                          P S 2 Replies 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