One of those bad days and now i find stuff like this...
-
if (doc.status==3)
{
// With this Status, nothing should be done here.
}
else if (doc.status == 2 || doc.status == 1)
{
AddDoc(doc);
}Finish();
Should i laugh or cry?
I just keep reading it, my mouth agape. I've read three pieces of code in the past 24 hours that look like this!
-
if (doc.status==3)
{
// With this Status, nothing should be done here.
}
else if (doc.status == 2 || doc.status == 1)
{
AddDoc(doc);
}Finish();
Should i laugh or cry?
-
if (doc.status==3)
{
// With this Status, nothing should be done here.
}
else if (doc.status == 2 || doc.status == 1)
{
AddDoc(doc);
}Finish();
Should i laugh or cry?
Maybe that first if statement was included for the purpose of pseudo-documentation. For example, maybe 3 should never have extra processing (e.g., it's a reserved doc status), but 4 or 5 might. However, they don't currently exist, so they weren't coded against. More than likely, though, this is part of some maintenance programming where only the minimum of changes required to make the program work were performed, leaving spaghetti behind.
-
if (doc.status==3)
{
// With this Status, nothing should be done here.
}
else if (doc.status == 2 || doc.status == 1)
{
AddDoc(doc);
}Finish();
Should i laugh or cry?
Take a
switch
to that guy. :-D -
Maybe that first if statement was included for the purpose of pseudo-documentation. For example, maybe 3 should never have extra processing (e.g., it's a reserved doc status), but 4 or 5 might. However, they don't currently exist, so they weren't coded against. More than likely, though, this is part of some maintenance programming where only the minimum of changes required to make the program work were performed, leaving spaghetti behind.
you're right
-
you're right
So YOU'RE the culprit who wrote the code!
-
So YOU'RE the culprit who wrote the code!
lol no, I have some lil' jewels of my own but no, that one isn't mine
-
Take a
switch
to that guy. :-DAnd then en
**case**
him in concrete. :)Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
-
And then en
**case**
him in concrete. :)Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
but that might break him.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
but that might break him.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
The three above comments made my night...thanks :D
-
I just keep reading it, my mouth agape. I've read three pieces of code in the past 24 hours that look like this!
I wish I could send you some of the code I'm reviewing currently but I can't due to a confidentiality momerandum. The above snippet looks like an oasis to me :wtf:
-
if (doc.status==3)
{
// With this Status, nothing should be done here.
}
else if (doc.status == 2 || doc.status == 1)
{
AddDoc(doc);
}Finish();
Should i laugh or cry?
-
if (doc.status==3)
{
// With this Status, nothing should be done here.
}
else if (doc.status == 2 || doc.status == 1)
{
AddDoc(doc);
}Finish();
Should i laugh or cry?
At times, when I have found things like this, I agree my first intent is to go find the person that wrote the code, but then, I sometimes stop and think, who REVIEWED IT and ALLOWED it into the code-base to start with? The does of course mean that you have a review cycle as part of your policies... Been to many places that don't, and then, yes, I run through the halls creaming for the head of the the programmer... and then use it as an example as to why they should implement code reviews :)
-
At times, when I have found things like this, I agree my first intent is to go find the person that wrote the code, but then, I sometimes stop and think, who REVIEWED IT and ALLOWED it into the code-base to start with? The does of course mean that you have a review cycle as part of your policies... Been to many places that don't, and then, yes, I run through the halls creaming for the head of the the programmer... and then use it as an example as to why they should implement code reviews :)
-
but that might break him.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me