Code WTF(s) OTD
-
The last example is not so bad, it is handy for setting breakpoints on certain conditions. Note, that while you can do this is in the debugger, it adds tonnes of overhead. In your case, it probably does not matter.
xacc.ide
IronScheme - 1.0 beta 3 - out now!
((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))leppie wrote:
it is handy for setting breakpoints on certain conditions
All it does is if one of four radio buttons are checked, a group box is made visible, otherwise its invisible.
grbKeyType.Visible = rdbPunchKey.Checked
That's what I would have done...
leppie wrote:
In your case, it probably does not matter.
No it doesn't, but I expect more of a programmer that has the credentials this one has... Much more That last example is right up there with
if (someBooleanCondition == true)
Miskien is ek net vol kak...Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111 -
I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.
timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
// Note that timeAtendancePunch.MiscCategoryID is of type longtimeAtendancePunch.PunchTypeID = 0;
// This is a foreign key in a static table in the db, but the ID's aren't static, their identity columnsprivate void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
{
if (rdbPunchKey.Checked)
{
grbKeyType.Visible = true;
}
else
{
grbKeyType.Visible = false;
}
}
// Note, rdbPunchKey is a radio button and grbKeyType is a group boxAnd there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.
Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111Errr.... there is a coding horrors section, you know?
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
leppie wrote:
it is handy for setting breakpoints on certain conditions
All it does is if one of four radio buttons are checked, a group box is made visible, otherwise its invisible.
grbKeyType.Visible = rdbPunchKey.Checked
That's what I would have done...
leppie wrote:
In your case, it probably does not matter.
No it doesn't, but I expect more of a programmer that has the credentials this one has... Much more That last example is right up there with
if (someBooleanCondition == true)
Miskien is ek net vol kak...Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111 -
Errr.... there is a coding horrors section, you know?
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
I'm well aware of that, but this is not a coding horror, its a coding WTF :laugh:
Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111 -
Errr.... there is a coding horrors section, you know?
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Well said that man!
-
I'm well aware of that, but this is not a coding horror, its a coding WTF :laugh:
Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111Put in a request for a new forum! We do have a Site Bugs and Suggestions forum, you know? :-D
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.
timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
// Note that timeAtendancePunch.MiscCategoryID is of type longtimeAtendancePunch.PunchTypeID = 0;
// This is a foreign key in a static table in the db, but the ID's aren't static, their identity columnsprivate void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
{
if (rdbPunchKey.Checked)
{
grbKeyType.Visible = true;
}
else
{
grbKeyType.Visible = false;
}
}
// Note, rdbPunchKey is a radio button and grbKeyType is a group boxAnd there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.
Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111 -
I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.
timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
// Note that timeAtendancePunch.MiscCategoryID is of type longtimeAtendancePunch.PunchTypeID = 0;
// This is a foreign key in a static table in the db, but the ID's aren't static, their identity columnsprivate void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
{
if (rdbPunchKey.Checked)
{
grbKeyType.Visible = true;
}
else
{
grbKeyType.Visible = false;
}
}
// Note, rdbPunchKey is a radio button and grbKeyType is a group boxAnd there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.
Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111Everyone makes mistakes. If you look back on your code in 5 years time I'm sure you'll be horrified by what you thought at the time was fantastic code.
Simon
-
I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.
timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
// Note that timeAtendancePunch.MiscCategoryID is of type longtimeAtendancePunch.PunchTypeID = 0;
// This is a foreign key in a static table in the db, but the ID's aren't static, their identity columnsprivate void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
{
if (rdbPunchKey.Checked)
{
grbKeyType.Visible = true;
}
else
{
grbKeyType.Visible = false;
}
}
// Note, rdbPunchKey is a radio button and grbKeyType is a group boxAnd there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.
Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111 -
leppie wrote:
it is handy for setting breakpoints on certain conditions
All it does is if one of four radio buttons are checked, a group box is made visible, otherwise its invisible.
grbKeyType.Visible = rdbPunchKey.Checked
That's what I would have done...
leppie wrote:
In your case, it probably does not matter.
No it doesn't, but I expect more of a programmer that has the credentials this one has... Much more That last example is right up there with
if (someBooleanCondition == true)
Miskien is ek net vol kak...Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111Often you'll need to set more than one thing or add some debug code Maybe the developer had problems with that code not working and added a debugging line or a breakpoint or maybe he saw that in the future he might need to enable a menu option
if (rdbPunchKey.Checked) { grbKeyType.Visible = true; EnableSomeMenuOption(); Console.WriteLine("Button Checked"); }
I definitely wouldn't see that as a wtf, there could be loads of reasons why that ended up like that. It doesn't look like the kind of code that's going to sitting in a big loop and if it is then there are probably bigger issues with the code than an unnecessary if statement Russ -
Everyone makes mistakes. If you look back on your code in 5 years time I'm sure you'll be horrified by what you thought at the time was fantastic code.
Simon
Everyone makes mistakes. If you look back on your code in 5 years time I'm sure you'll be horrified by what you thought at the time was fantastic code. QFT!!!
-
Harvey Saayman wrote:
but the ID's aren't static, their identity columns
Grammer WTF OTD sorry, couldn't resist. :-\
J4amieC wrote:
Grammer WTF OTD
That would be Kelsey then. Would he be using grammar?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.
timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
// Note that timeAtendancePunch.MiscCategoryID is of type longtimeAtendancePunch.PunchTypeID = 0;
// This is a foreign key in a static table in the db, but the ID's aren't static, their identity columnsprivate void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
{
if (rdbPunchKey.Checked)
{
grbKeyType.Visible = true;
}
else
{
grbKeyType.Visible = false;
}
}
// Note, rdbPunchKey is a radio button and grbKeyType is a group boxAnd there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.
Harvey Saayman - South Africa Software Developer .Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111in the last example, he is just being verbose - nothing wrong with that could have been done on purpose for any number of reasons. however, someone with time on the job, all things being equal, would normally write grbKeyType.Visible = rdbPunchKey.Checked given a choice i would rather see this kind of WTFs than the ones that introduce logic errors let this be a lesson for all you certifications fanboys...
Opium is my business. The bridge mean more traffic. More traffic mean more money. More money mean more power. Speed is important in business. Time is money. You said opium was money. Money is Money. Well then, what is time again? icalburner