Comment On The Vista Fix

"I was hired on to take things over from a fellow named 'Trent', who was known for writing some stunningly awful code," Michael writes, "I was not only to be tasked with rewriting one of our two main software products into a modern language (compared to the VB6 in which it was currently built), but in the short term I was also tasked with maintaining the older versions. " [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Re: The Vista Fix

2011-05-02 12:34 • by Power Troll
On Error Comment

Re: The Vista Fix

2011-05-02 12:36 • by D Martensson (unregistered)
I had a collegue 5-6 years ago that used the same "fix" in a conversion program, another collegue invented some very new bad words when trying to upgrade it later ;)

Re: The Vista Fix

2011-05-02 12:39 • by WC (unregistered)
At some point, you've got 'new' and 'old' backwards. I suspect Trent implemented it in the old version, and the submitter implemented it in the new version.

Re: The Vista Fix

2011-05-02 12:42 • by GalacticCowboy
s/Trent/Steve/

Fixed that for ya.

Re: The Vista Fix

2011-05-02 12:42 • by Zolcos
That was probably the right decision. It doesn't really fix anything, of course, but doing it the right way would just waste a lot more time. This way he can get to finishing the rewrite.
WC:
At some point, you've got 'new' and 'old' backwards. I suspect Trent implemented it in the old version, and the submitter implemented it in the new version.

I get the feeling that both the new and old versions were 'old' and not part of his rewrite

Re: The Vista Fix

2011-05-02 12:52 • by dohpaz42
346006 in reply to 346001
Power Troll:
On Error Resume Comment


FTFY

Re: The Vista Fix

2011-05-02 12:55 • by Brogrammer (unregistered)
Cool story, bro.

Re: The Vista Fix

2011-05-02 12:56 • by Roman (unregistered)
346008 in reply to 346006
dohpaz42:
Power Troll:
On Error Resume Comment


FTFY


On Troll First Post

Re: The Vista Fix

2011-05-02 12:59 • by Vilx- (unregistered)
That's not the Vista Fix! That's the Universal Panacea! He has finally done it! He has found the way to make any software run error-free!

Well, as long as that software is written in VB6 at least.

Re: The Vista Fix

2011-05-02 12:59 • by Bryan the K (unregistered)
The real WTF is support for Vista? Right??

Re: The Vista Fix

2011-05-02 13:01 • by Mr. Cranky Language Person (unregistered)
"Poring through the code"

Thanks for getting that right.

Re: The Vista Fix

2011-05-02 13:04 • by frits
346012 in reply to 346001
Power Troll:
On Error Comment

TRWTF is comments.

Re: The Vista Fix

2011-05-02 13:05 • by blah (unregistered)
TRWTF is not performing a diff. Presumably TRRWTF is no source control.

Re: The Vista Fix

2011-05-02 13:11 • by DCRoss
Problem: Software is showing error messages to user while running.

Expected Result: User should not see error messages while running software.

Fix: Obvious.

Re: The Vista Fix

2011-05-02 13:15 • by Brian (unregistered)
Sadly, the Vista Fix requires you to dynamically generate all of your controls. Otherwise, users might still see errors when one of your controls fails to load (e.g., because the user is missing the .ocx file).

Re: The Vista Fix

2011-05-02 13:33 • by Nagesh
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.

Re: The Vista Fix

2011-05-02 13:36 • by Al Jaseera (unregistered)
It is good thing Vista fix was implemented on DNA testing algorithm.

Re: The Vista Fix

2011-05-02 13:40 • by Niten (unregistered)
346018 in reply to 346016
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



Not all great programmers have a Computer Science degree. For that matter, not all great programmers went to college.

And plenty of people with computer science degrees write bad code.

Re: The Vista Fix

2011-05-02 13:42 • by Fact Checker (unregistered)
346019 in reply to 346018
Niten:
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



Not all great programmers have a Computer Science degree. For that matter, not all great programmers went to college.

And plenty of people with computer science degrees write bad code.


Indeed. My facts say that not one great programmer has a Computer Science degree. Also: every person with a computer science degree writes bad code.

Re: The Vista Fix

2011-05-02 13:44 • by Nagesh
346020 in reply to 346018
Niten:
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



Not all great programmers have a Computer Science degree. For that matter, not all great programmers went to college.

And plenty of people with computer science degrees write bad code.


Structure thinking v/s unstructure thinking. That is pipe dream. Name 4 great programmer candidates who did not have CS degree and I will show bugs in their code.

Re: The Vista Fix

2011-05-02 13:45 • by Jo Poser (unregistered)
"Poring"? Was it stinky or filmy?

nobis... you can only spell "America" with nobis. Or something similarly stupid and confusing.

Re: The Vista Fix

2011-05-02 13:45 • by trtrwtf (unregistered)
346022 in reply to 346019
Fact Checker:

Indeed. My facts say that not one great programmer has a Computer Science degree. Also: every person with a computer science degree writes bad code.


I know a great programmer with a computer science degree. Actually, two. Three, now I come to think of it. Go check your facts.

Re: The Vista Fix

2011-05-02 13:49 • by fritters (unregistered)
346023 in reply to 346011
Mr. Cranky Language Person:
"Poring through the code"

Thanks for getting that right.


No no, it's "pouring" through the code.

As in, gasoline.

Re: The Vista Fix

2011-05-02 13:50 • by PedanticCurmudgeon
346024 in reply to 346016
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.

In my day, when someone was ashamed to mention something, they didn't mention it.

Oh, and I walked to school uphill, both ways, etc.

Re: The Vista Fix

2011-05-02 13:51 • by C-Octothorpe (unregistered)
346025 in reply to 346016
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



It's really, really sad to see how often I see supposedly "senior" or "intermediate" developers writing code like this:
try

{
var returnValue = int.Parse(stringVal);
return returnValue;
}
catch
{
// something is wrong...
return null;
}

The code comment, sadly, is not mine. There was also an evil brother version of this which had an object passed in.

try
{
return int.Parse((string)objectValue.ToString());
}
catch
{
return "";
}


Oh yeah, you got it! Different return values between both catches and the unhandled null ref exception, etc., etc. And lets not even mention the rewriting (badly) of existing framework code... I guess System.Int32.Parse threw too many exceptions for the developers taste.

I've had discussions with developers who are convinced that an application should never throw an error.

Re: The Vista Fix

2011-05-02 14:17 • by Matthew Vines (unregistered)
346029 in reply to 346020
Nagesh:
Niten:
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



Not all great programmers have a Computer Science degree. For that matter, not all great programmers went to college.

And plenty of people with computer science degrees write bad code.


Structure thinking v/s unstructure thinking. That is pipe dream. Name 4 great programmer candidates who did not have CS degree and I will show bugs in their code.


Name 4 programmers and I will show bugs in their code.

Re: The Vista Fix

2011-05-02 14:22 • by Pedantic CBE (unregistered)
346031 in reply to 346025
C-Octothorpe:

I've had discussions with developers who are convinced that an application should never throw an error.

Well, I can see where that idea is coming from.

A GUI* application shouldn't ever die with an error unless that error is genuinely fatal and irrecoverable. In other words - out of memory or hardware fault.

Any errors it does display should be only be caused by user error, and should never cause it to die - it should tell the user what they did wrong so they can do it right.

So by extension any 'thrown' errors shouldn't ever get to the top layer and kill the app, and must be caught and dealt with appropriately further down the stack.

Of course, that doesn't mean you should just catch errors for no reason.

*Command-line on the o0ther hand should die as quickly as possible with a good error message so the user isn't sat for ages waiting for it to fail on their erroneous input.

Re: The Vista Fix

2011-05-02 14:23 • by Jeff (unregistered)
346032 in reply to 346014
DCRoss:
Problem: Software is showing error messages to user while running.

Expected Result: User should not see error messages while running software.

Fix: Obvious.
Shoot user?

Re: The Vista Fix

2011-05-02 14:28 • by DaveK
346033 in reply to 346004
GalacticCowboy:
s/Trent/Steve/

Fixed that for ya.
Same Mike/Michael and Trent as http://thedailywtf.com/Articles/Feng-Shui.aspx from the sound of it.

Re: The Vista Fix

2011-05-02 14:29 • by the guy behind you (unregistered)
346034 in reply to 346023
fritters:
Mr. Cranky Language Person:
"Poring through the code"

Thanks for getting that right.


No no, it's "pouring" through the code.

As in, gasoline.


petrol?

Re: The Vista Fix

2011-05-02 14:40 • by frits
346036 in reply to 346031
Pedantic CBE:
C-Octothorpe:

I've had discussions with developers who are convinced that an application should never throw an error.

Well, I can see where that idea is coming from.

A GUI* application shouldn't ever die with an error unless that error is genuinely fatal and irrecoverable. In other words - out of memory or hardware fault.

Any errors it does display should be only be caused by user error, and should never cause it to die - it should tell the user what they did wrong so they can do it right.

So by extension any 'thrown' errors shouldn't ever get to the top layer and kill the app, and must be caught and dealt with appropriately further down the stack.

Of course, that doesn't mean you should just catch errors for no reason.

*Command-line on the o0ther hand should die as quickly as possible with a good error message so the user isn't sat for ages waiting for it to fail on their erroneous input.


OK. Cool. So which pattern do you use?
On Error Resume Next

or

try
{
//Do stuff
}
catch(Exception swallowAll)
{
//Gulp! Bellllllllllch!
}


Re: The Vista Fix

2011-05-02 14:42 • by hoodaticus
346037 in reply to 346016
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.

It's perfectly valid in some situations. Like adding non-unique entries to a hashtable to get the unique exemplars, for hashtables that do not have a ContainsKey method.

Re: The Vista Fix

2011-05-02 14:44 • by jmucchiello
346038 in reply to 346013
blah:
TRWTF is not performing a diff. Presumably TRRWTF is no source control.

This, and the lack of source control is almost a given.

Re: The Vista Fix

2011-05-02 14:47 • by C-Octothorpe (unregistered)
346039 in reply to 346031
Pedantic CBE:
C-Octothorpe:

I've had discussions with developers who are convinced that an application should never throw an error.

Well, I can see where that idea is coming from.

A GUI* application shouldn't ever die with an error unless that error is genuinely fatal and irrecoverable. In other words - out of memory or hardware fault.

Any errors it does display should be only be caused by user error, and should never cause it to die - it should tell the user what they did wrong so they can do it right.

So by extension any 'thrown' errors shouldn't ever get to the top layer and kill the app, and must be caught and dealt with appropriately further down the stack.

Of course, that doesn't mean you should just catch errors for no reason.

*Command-line on the o0ther hand should die as quickly as possible with a good error message so the user isn't sat for ages waiting for it to fail on their erroneous input.


Well, the real issue is swallowing and "gracefully" catching the errors during development (I should have specified that). During development, you want the application to crash fast and crash hard. Having a little popup error message you can easily dismiss so you can get to the page you're developing, or better yet swallowing any/all error messages is just bad, bad, bad and should be punishable by death by basketball.

I can't tell you how many times I have seen exceptions "handled" only to come and severely bite the developers in the ass during a production issue. Anytime something goes wrong during a user transaction, you need to tell them that something bad happened. Unless of course the exception was logged, corrected and that you can guarantee that the correction succeeded and nothing was lost with no side effect, in other words, as if the original transaction occured without error. Then and only then should you not notify the user, IMO.

Re: The Vista Fix

2011-05-02 14:50 • by Michael (unregistered)
346040 in reply to 346032
Jeff:
DCRoss:
Problem: Software is showing error messages to user while running.

Expected Result: User should not see error messages while running software.

Fix: Obvious.
Shoot user?
I see no reason to be so harsh. Just unplug their monitor.

If they plug it back in, then you can shoot them.

Re: The Vista Fix

2011-05-02 14:51 • by Michael (really) (unregistered)
346041 in reply to 346005
Zolcos:
That was probably the right decision. It doesn't really fix anything, of course, but doing it the right way would just waste a lot more time. This way he can get to finishing the rewrite.
WC:
At some point, you've got 'new' and 'old' backwards. I suspect Trent implemented it in the old version, and the submitter implemented it in the new version.

I get the feeling that both the new and old versions were 'old' and not part of his rewrite


That is correct...the 'new' one was a reskinning of the old software, but with all the same code. The future rewrite was actually in Delphi.

Re: The Vista Fix

2011-05-02 14:53 • by C-Octothorpe (unregistered)
346042 in reply to 346040
Michael:
Jeff:
DCRoss:
Problem: Software is showing error messages to user while running.

Expected Result: User should not see error messages while running software.

Fix: Obvious.
Shoot user?
I see no reason to be so harsh. Just unplug their monitor.

If they plug it back in, then you can shoot them.


No. You fray the wires so that they become ground when they try to plug it in again.

Re: The Vista Fix

2011-05-02 14:58 • by Nagesh (unregistered)
346043 in reply to 346017
Al Jaseera:
It is good thing Vista fix was implemented on DNA testing algorithm.

You have made my day!!!! May my idol still be living!?!?!?!

Re: The Vista Fix

2011-05-02 15:02 • by Michael (really) (unregistered)
346044 in reply to 346033
DaveK:
GalacticCowboy:
s/Trent/Steve/

Fixed that for ya.
Same Mike/Michael and Trent as http://thedailywtf.com/Articles/Feng-Shui.aspx from the sound of it.


Negative...I don't recall what name I gave when submitting this story, but I don't think it was Trent (I don't even remember the original programmer's name at this point, which is surprising considering how often I silently cursed his name). I can state with authority I AM a Michael, though, and I didn't submit that story.

And per other commenters: no, no version control. I'd have fixed that but I got into that job with almost no programming experience and 1 year of schooling 5 years prior. So my programming knowledge (including, admittedly, the mere existence of source control) was acquired entirely on the job.

Trust me, lack of source control was the LEAST of their problems.

Re: The Vista Fix

2011-05-02 15:05 • by Peter (unregistered)
346045 in reply to 346042
C-Octothorpe:
Michael:
Jeff:
Shoot user?
I see no reason to be so harsh. Just unplug their monitor.

If they plug it back in, then you can shoot them.
No. You fray the wires so that they become ground when they try to plug it in again.
"Ground" as in "ground beef"?

Re: The Vista Fix

2011-05-02 15:08 • by BentFranklin (unregistered)
On Error Update Resume

Re: The Vista Fix

2011-05-02 15:10 • by Silfax
346047 in reply to 346014
DCRoss:
Problem: Software is showing error messages to user while running.

Expected Result: User should not see error messages while running software.

Fix: Obvious.


Would that be the "two fingered eyeball poke" or routing all error messages to /dev/null ?

Re: The Vista Fix

2011-05-02 15:30 • by Rootbeer
After 10 minutes of staring at the code, I just happened to glance up at the very top


What the...? Did this happen before the invention of 'diff'?

Re: The Vista Fix

2011-05-02 15:33 • by drusi (unregistered)
346049 in reply to 346019
Fact Checker:
Niten:
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



Not all great programmers have a Computer Science degree. For that matter, not all great programmers went to college.

And plenty of people with computer science degrees write bad code.


Indeed. My facts say that not one great programmer has a Computer Science degree. Also: every person with a computer science degree writes bad code.


It's true! I have a computer science degree, and I write bad code. In my defense, I work on bad projects.

Huh, apparently this is the second time I've had "modo" as my captcha.

Re: The Vista Fix

2011-05-02 15:49 • by Anon (unregistered)
346050 in reply to 346043
Wasn't he living in Pakistan?

I though Indians hated Pakistanis.

Why would he be your idol?

Re: The Vista Fix

2011-05-02 15:51 • by Nagesh
346051 in reply to 346024
PedanticCurmudgeon:
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.

In my day, when someone was ashamed to mention something, they didn't mention it.

Oh, and I walked to school uphill, both ways, etc.


Lot of childs in my class walk to school with no shoes. So no big deal. I was lucky to get auto.

Re: The Vista Fix

2011-05-02 15:58 • by laoreet (unregistered)
346052 in reply to 346019
Fact Checker:
Niten:
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



Not all great programmers have a Computer Science degree. For that matter, not all great programmers went to college.

And plenty of people with computer science degrees write bad code.


Indeed. My facts say that not one great programmer has a Computer Science degree. Also: every person with a computer science degree writes bad code.


F U

Re: The Vista Fix

2011-05-02 15:58 • by Craig (unregistered)
I figured that maybe The Vista Fix was that the software uninstalled Vista and installed Windows XP.

Re: The Vista Fix

2011-05-02 16:00 • by Jaime
346054 in reply to 346016
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.

On Error Resume Next creates a flow where no call ever fails hard and you have to check the error code on the statement immediately after the call. This is the standard error handling model for old-fashioned C. I love it when a pattern is seen as good in C, but the same pattern is evil in VB.

On a related note, occasionally my workstation at work gets into a state where all window creation fails. It's interesting to see how many applications don't check to see if CreateWindow returns a valid handle.

Re: The Vista Fix

2011-05-02 16:00 • by laoreet (unregistered)
346055 in reply to 346025
C-Octothorpe:
Nagesh:
I did one class for VB6 that I ashamed to mention

I remember the instructer telling me that never use "ON ERROR RESUME NEXT". I think the person who write this code did not go to class.



It's really, really sad to see how often I see supposedly "senior" or "intermediate" developers writing code like this:
try

{
var returnValue = int.Parse(stringVal);
return returnValue;
}
catch
{
// something is wrong...
return null;
}

The code comment, sadly, is not mine. There was also an evil brother version of this which had an object passed in.

try
{
return int.Parse((string)objectValue.ToString());
}
catch
{
return "";
}


Oh yeah, you got it! Different return values between both catches and the unhandled null ref exception, etc., etc. And lets not even mention the rewriting (badly) of existing framework code... I guess System.Int32.Parse threw too many exceptions for the developers taste.

I've had discussions with developers who are convinced that an application should never throw an error.


I don't think you know what you're talking about. Try again.
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Add Comment