|
I've seen similar stuff in places that for some unknown reason didn't use source control, but rather comments as a versioning mechanism. (No, that place is no longer in business... Surprise) The OP probably just copied and pasted it with the intention of modifying the code, but in this case I think he forgot to perform the latter.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Thats why code source control and review is important.
|
|
|
|
|
Someone give them a git or svn already, srysly >_>
|
|
|
|
|
Where I work we have classes that consist for about 50% of code like that. And that while we use SVN :p
I guess some people just do not dare to delete code. And probably you would not dare either if you worked at my company
It's an OO world.
|
|
|
|
|
A place I worked at had the same thing because they didn't have any form of source control, once I got them to implement source control most of this sort of stuff was cleaned out.
This particular code may also be the result of someone who doesn't "trust" source control and thinks that this is a better option, of course than person is a deluded fool but you never know.
People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs
|
|
|
|
|
I have seen that happen because some people either do not understand what source control is or do not trust it.
|
|
|
|
|
It's really disgusting. At least they might comment only the particular line instead of whole thing & new copy of that.
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}
Also they may create another parameter for sp_name in the method.
|
|
|
|
|
|
Ahh... admittedly, I've been guilty of leaving commented code behind, but they were left behind to work with later. However, I don't think I ever commented copied code like that...
|
|
|
|
|
I'll admit to leaving comments behind when I'm designing new stuff but want to be able to refer to the old stuff, but I only leave it there when I forget or get distracted before finishing the new function.
|
|
|
|
|
Users should left a reason for voting,either it is good or bad. It will make other users to think better in future.I have noticed some users never do it.is it good ? let others users know what is the point that you appreciate or not like.. Thanks to all.
modified on Thursday, March 3, 2011 4:07 PM
|
|
|
|
|
What the heck are you on about?
|
|
|
|
|
|
Monjurul Habib wrote: that is you,5+
Huh?
|
|
|
|
|
|
Hi it's me, the Monthy Python!
|
|
|
|
|
I voted you a 5 what's the point of voting someone a 1 unless you tell them why. Will they learn from their mistake, probably not.
"You get that on the big jobs."
|
|
|
|
|
my view is better to point him, where he made mistake.).
|
|
|
|
|
This is already implemented in some places of the forum... Anyway... if you want to make suggestions you should use the right forum...
|
|
|
|
|
I downloaded some code of the internet which is used as part of Firefox, OpenOffice etc, compiled it and it produced a few warnings. I'm not a fan of warnings so thought I'd have a look to fix it...
if (((rv) &&
( checked_prefix || (words && words[wnum]) ||
(compoundflag && TESTAFF(rv->astr, compoundflag, rv->alen)) ||
((oldwordnum == 0) && compoundbegin && TESTAFF(rv->astr, compoundbegin, rv->alen)) ||
((oldwordnum > 0) && compoundmiddle && TESTAFF(rv->astr, compoundmiddle, rv->alen))
|| ((langnum == LANG_hu) && hu_mov_rule && (
TESTAFF(rv->astr, 'F', rv->alen) || TESTAFF(rv->astr, 'G', rv->alen) ||
TESTAFF(rv->astr, 'H', rv->alen)
)
)
) &&
(
scpd == 0 || checkcpdtable[scpd-1].cond == FLAG_NULL ||
TESTAFF(rv->astr, checkcpdtable[scpd-1].cond, rv->alen)
)
&& ! (( checkcompoundtriple && scpd == 0 && !words && (word[i-1]==word[i]) && (
((i>1) && (word[i-1]==word[i-2])) ||
((word[i-1]==word[i+1])) )
) ||
(
checkcompoundcase && scpd == 0 && !words && cpdcase_check(word, i)
))
)
|| ((!rv) && (langnum == LANG_hu) && hu_mov_rule && (rv = affix_check(st,i)) &&
(sfx && sfx->getCont() && ( TESTAFF(sfx->getCont(), (unsigned short) 'x', sfx->getContLen()) ||
TESTAFF(sfx->getCont(), (unsigned short) '%', sfx->getContLen())
)
)
)
) {
}
In fairness, it's the first time I've seen so many comments inside an if statement! Think I'll live with the warning (i.e. disable it for that particular file.)
|
|
|
|
|
This is simply ridiculous..
|
|
|
|
|
33 lines long condition in this piece of code is absolutely adorable!
A drunk disassembler would have done a better job generating such code No kidding - recently, I had to restore some source code from a compiled dll, and reflector's result was way more reasonable than this one.
|
|
|
|
|
I've never seen this code before but assume it must be TKSpell. Yes, it's a horribly long conditional, but the code layout and comments make it reasonably clear as to what's happening.
I know that i'm going to offend a lot of people, but a large function is not, repeat not, in itself a sign of bad programming. If the routine does exactly one well defined thing, it doesn't matter how large it is counting lines of code.
And now i hear the refactoring crowd shouting at me. OK guys, you spend your time refactoring. I spend my time producing good solid production code.
|
|
|
|
|
Sam Cragg wrote: ) ) ) ) IHMO this is the best part of it.
Greetings - Jacek
|
|
|
|
|
The layout is not pretty and I would have commented it a lot more thoroughly, but there is nothing wrong with a complex if statement. I know that the refactoring polizei will feel that 1000 statements are better than one but as long as the code is well laid out and well commented (which this isn't), then a single statement can be simpler to follow.
The warning, incidentally, is for the final stanza in the line after the comment // LANG_hu section: spec. Hungarian rule . The compiler is guessing that rv = affix_check(st,i) should be rv == affix_check(st,i)
|
|
|
|