It's not the most horrible code but it is pointless
-
bool hasWarnings = false;
if (!hasWarnings)
{
hasWarnings = true;
} -
bool hasWarnings = false;
if (!hasWarnings)
{
hasWarnings = true;
}I just saw a piece of javascript today which effectively looked like this:
function check_somethingOrOther()
{
someVariable = false;
setTimeout("check_somethingOrOther()", 500);
}Now, I know that someVariable was obviously meant to do something, but this is the only place in the code that it's actually used. Optimising this code was really simple.
I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be
Forgive your enemies - it messes with their heads
-
bool hasWarnings = false;
if (!hasWarnings)
{
hasWarnings = true;
}I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.
private bool IsValid()
{
return true;
}I wasn't, now I am, then I won't be anymore.
-
I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.
private bool IsValid()
{
return true;
}I wasn't, now I am, then I won't be anymore.
-
I just saw a piece of javascript today which effectively looked like this:
function check_somethingOrOther()
{
someVariable = false;
setTimeout("check_somethingOrOther()", 500);
}Now, I know that someVariable was obviously meant to do something, but this is the only place in the code that it's actually used. Optimising this code was really simple.
I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be
Forgive your enemies - it messes with their heads
Yes, but what if it changes. You have to make sure it is really false! :-D
-
If it were a polymorphic function that could be overridden by a derived class then it could make sense. However, in your context it does seem very strange.
Unfortunately, no. This class was never inherited. I honestly don't think the guy who wrote it originally even knew what that was.
I wasn't, now I am, then I won't be anymore.
-
I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.
private bool IsValid()
{
return true;
}I wasn't, now I am, then I won't be anymore.
PogoboyKramer wrote:
I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.
You fool! Now *nothing* will be valid. Wasn't it better when it was ALL valid? How is anything supposed to work unless it's valid?
He said, "Boy I'm just old and lonely, But thank you for your concern, Here's wishing you a Happy New Year." I wished him one back in return.
-
PogoboyKramer wrote:
I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.
You fool! Now *nothing* will be valid. Wasn't it better when it was ALL valid? How is anything supposed to work unless it's valid?
He said, "Boy I'm just old and lonely, But thank you for your concern, Here's wishing you a Happy New Year." I wished him one back in return.