a minor horror
-
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
-
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
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
-
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
-
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
-
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
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
-
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
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
-
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
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.
-
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.
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
-
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