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. The Weird and The Wonderful
  4. a minor horror

a minor horror

Scheduled Pinned Locked Moved The Weird and The Wonderful
regexlearning
9 Posts 4 Posters 1 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.
  • B Offline
    B Offline
    BillW33
    wrote on last edited by
    #1

    I found this in some legacy code at a place where I worked: public class MyClass { private FooEventArgs Foo_Event; public void MyMethod() { Foo_Event = new FooEventArgs( … ); . . . } } Foo_Event is used only in MyMethod, but it is declared as an instance variable of the class. At least they did not make it public ;). Also I really don't like having "_Event" appended to the variable name. It isn't an event it is event arguments. Of course, this pattern was repeated for several variables. Bill W

    P C 2 Replies Last reply
    0
    • B BillW33

      I found this in some legacy code at a place where I worked: public class MyClass { private FooEventArgs Foo_Event; public void MyMethod() { Foo_Event = new FooEventArgs( … ); . . . } } Foo_Event is used only in MyMethod, but it is declared as an instance variable of the class. At least they did not make it public ;). Also I really don't like having "_Event" appended to the variable name. It isn't an event it is event arguments. Of course, this pattern was repeated for several variables. Bill W

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

      Just refactor the code. :~

      "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 "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

      B 1 Reply Last reply
      0
      • P Paul Conrad

        Just refactor the code. :~

        "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 "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

        B Offline
        B Offline
        BillW33
        wrote on last edited by
        #3

        Yep, that is exactly what I did ;) I just find this kind of code irksome. Bill W

        P 1 Reply Last reply
        0
        • B BillW33

          Yep, that is exactly what I did ;) I just find this kind of code irksome. Bill W

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

          Hopefully that particular coder isn't somewheres else coding mission critical stuff...

          "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 "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

          B 1 Reply Last reply
          0
          • P Paul Conrad

            Hopefully that particular coder isn't somewheres else coding mission critical stuff...

            "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 "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

            B Offline
            B Offline
            BillW33
            wrote on last edited by
            #5

            I just know they are no longer working at the same place. But, the code does work so no one, other than fellow programmers, would even be aware that there is something wrong with the code. This is one of the reasons that I believe in peer code review, not to critize, but to give folk a chance to learn better ways of doing things. Bill W

            P 1 Reply Last reply
            0
            • B BillW33

              I just know they are no longer working at the same place. But, the code does work so no one, other than fellow programmers, would even be aware that there is something wrong with the code. This is one of the reasons that I believe in peer code review, not to critize, but to give folk a chance to learn better ways of doing things. Bill W

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

              CIDev wrote:

              This is one of the reasons that I believe in peer code review, not to critize, but to give folk a chance to learn better ways of doing things.

              I totally agree. A peer review of the code you posted could have perhaps helped the coder improve. Of course that depends if they are open to constructive criticism.

              "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 "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

              S 1 Reply Last reply
              0
              • P Paul Conrad

                CIDev wrote:

                This is one of the reasons that I believe in peer code review, not to critize, but to give folk a chance to learn better ways of doing things.

                I totally agree. A peer review of the code you posted could have perhaps helped the coder improve. Of course that depends if they are open to constructive criticism.

                "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 "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                S Offline
                S Offline
                sa_runner
                wrote on last edited by
                #7

                I agree with the code review and that one hopes the programmer is open for constructive criticism. However, the one giving the advice should also be open to rebuttal. I've been in situations where I give an answer, in a nice, logical tone and got blasted for going against the criticism. I wasn't trying to be rude, but explaining why I did what I did. Of course, the guy giving the criticism was a hot head to begin with, which may not have helped. :) But yes, code reviews are very helpful and a good learning environment as long as all parties are open-minded to some degree.

                P 1 Reply Last reply
                0
                • S sa_runner

                  I agree with the code review and that one hopes the programmer is open for constructive criticism. However, the one giving the advice should also be open to rebuttal. I've been in situations where I give an answer, in a nice, logical tone and got blasted for going against the criticism. I wasn't trying to be rude, but explaining why I did what I did. Of course, the guy giving the criticism was a hot head to begin with, which may not have helped. :) But yes, code reviews are very helpful and a good learning environment as long as all parties are open-minded to some degree.

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

                  sa_runner wrote:

                  the one giving the advice should also be open to rebuttal

                  I agree.

                  sa_runner wrote:

                  the guy giving the criticism was a hot head to begin with

                  So like Donald Duck?

                  sa_runner wrote:

                  as long as all parties are open-minded to some degree

                  That is indeed a necessity for a code review.

                  "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 "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                  1 Reply Last reply
                  0
                  • B BillW33

                    I found this in some legacy code at a place where I worked: public class MyClass { private FooEventArgs Foo_Event; public void MyMethod() { Foo_Event = new FooEventArgs( … ); . . . } } Foo_Event is used only in MyMethod, but it is declared as an instance variable of the class. At least they did not make it public ;). Also I really don't like having "_Event" appended to the variable name. It isn't an event it is event arguments. Of course, this pattern was repeated for several variables. Bill W

                    C Offline
                    C Offline
                    cliran
                    wrote on last edited by
                    #9

                    guess hes really performance-oriented, not wanting to allocate memory for the eventArgs at actual runtime...

                    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