• Some damn Yank (unregistered) in reply to the guy behind you
    the guy behind you:
    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?

    To Brits, yes. In America we make lots of stuff from petroleum, not just gasoline, so "petrol" isn't specific enough for us. You Brits should understand this - you're BP crew gave us petrolated shrimp, petrolated beaches, petrolated turtles, petrolated dolphins...

    "ingenium" - readers of the Daily WTF are members of the ingenium.

  • (cs) in reply to Jaime
    Jaime:
    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.

    jaime, in C I remember we always are told to throw exception to the highest caller or was that C++? i m having memory trubles.

  • C-Octothorpe (unregistered) in reply to laoreet
    laoreet:
    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.

    My god, with an eloquent response like that, we should obviously listen to you! Why don't you enlighten us all with the Right Way (TM) professor? I mean, clearly my years of experience cowers next to the intellectual prowess of someone who can only muster "I don't think"...

    It is you who should try again.

  • Gunslinger (unregistered) in reply to Bryan the K
    Bryan the K:
    The real WTF is support for Vista? Right??

    Yes.

  • Gunslinger (unregistered) in reply to Nagesh
    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.

    Your instructor is wrong. There are certain conditions when you do want to do that.

  • C-Octothorpe (unregistered) in reply to Craig
    Craig:
    I figured that maybe The Vista Fix was that the software uninstalled Vista and installed Windows XP.

    Win.

  • Gunslinger (unregistered) in reply to Fact Checker
    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.

    Your facts and logic are flawed. A person who writes good code will suddenly write bad code just because they get a degree?

  • Abso (unregistered) in reply to Jaime
    Jaime:
    Nagesh:
    (trolling)
    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.
    It's almost like C and VB are two very different languages with different purposes.
  • Gunslinger (unregistered) in reply to Michael (really)
    Michael (really):
    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.

    I agree, moving to Delphi is a much bigger problem than lack of source control.

  • Gunslinger (unregistered) in reply to Craig
    Craig:
    I figured that maybe The Vista Fix was that the software uninstalled Vista and installed Windows XP.

    That wouldn't be a WTF.

  • socknet (unregistered) in reply to Rootbeer
    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'?

    if a lot of code has changed in the file, then even with diff it may well take 10+ minutes to find which particular change is responsible.

  • Bob (unregistered) in reply to Nagesh

    Name me any programmer and I will show bugs in their code.

  • Yoda (unregistered) in reply to Matthew Vines
    Matthew Vines:
    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.

    Show bugs in their code I will if 4 programmers you name.

  • some dude (unregistered) in reply to Jo Poser
    Jo Poser:
    "Poring"? Was it stinky or filmy?

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

    um. http://www.merriam-webster.com/dictionary/poring

  • (cs) in reply to Silfax

    Something like this bit us on the ankles recently. Our in-house signature app uses a 3rd-party piece of s...oftware called "lex" or something which makes some stuff easier, apparently.

    We recently upgraded to a new version of our in-house app. Ran it, it exited immediately (within the first few seconds). No error messages, no logs, no nothing to help us. Embarrassing as we were on the client's site at the time. Back in the office the software dev guys pondered it, then suggested we install a version of lex.jar from a few versions previous. This we did. Excellent - it sent a message to the log we'd been expecting to see something in to the effect that the jre was off kilter - and we could work out what had gone wrong from there.

    The WTF, of course, is that this later version of lex.jar no longer writes out its helpful stack traces to the logger. We know now to include "lex.jar_old" to our environment so we can swap it in as needs be when the s...oftware hits the fan again.

    Come on, say it, "the real WTF is using java". Sorry, but there we are, that's what we use, it's what I do to make money.

  • (cs) in reply to Some damn Yank
    Some damn Yank:
    the guy behind you:
    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?

    To Brits, yes. In America we make lots of stuff from petroleum, not just gasoline, so "petrol" isn't specific enough for us. You Brits should understand this - you're BP crew gave us petrolated shrimp, petrolated beaches, petrolated turtles, petrolated dolphins...

    "ingenium" - readers of the Daily WTF are members of the ingenium.

    Oh we did, we did. Mind, the only thing British about BP is the name, we sold the company to the US a long time ago. But why should we care? It's not our beaches.

  • (cs) in reply to Yoda
    Yoda:
    Matthew Vines:
    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.

    Show bugs in their code I will if 4 programmers you name.

    you are making use of even poorer gramer than I am.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    Something like this bit us on the ankles recently. Our in-house signature app uses a 3rd-party piece of s...oftware called "lex" or something which makes some stuff easier, apparently.

    We recently upgraded to a new version of our in-house app. Ran it, it exited immediately (within the first few seconds). No error messages, no logs, no nothing to help us. Embarrassing as we were on the client's site at the time. Back in the office the software dev guys pondered it, then suggested we install a version of lex.jar from a few versions previous. This we did. Excellent - it sent a message to the log we'd been expecting to see something in to the effect that the jre was off kilter - and we could work out what had gone wrong from there.

    The WTF, of course, is that this later version of lex.jar no longer writes out its helpful stack traces to the logger. We know now to include "lex.jar_old" to our environment so we can swap it in as needs be when the s...oftware hits the fan again.

    Come on, say it, "the real WTF is using java". Sorry, but there we are, that's what we use, it's what I do to make money.

    Sorry,but java's superiority is unmatched and style is also good.

  • (cs) in reply to Gunslinger
    Gunslinger:
    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.

    Your facts and logic are flawed. A person who writes good code will suddenly write bad code just because they get a degree?

    He is looking for starting flaming war.

  • Matt (unregistered)

    With out project, it takes "The Vista Fix" a step further. There is a requirement that every user interaction, MUST be enclosed in a try/catch block that dutifly hides all errors from ever being shown to the user. We instead log the error to an internal table. Never mind that no one ever looks at the table. What caused the error makes no difference - corrupt data? Just trap and log it - then dutifly ignore it. We're not talking about a few error per week - we're talking several thousand a day. The end user must never be allowed to know that an error occurred. The end result is management is now entirely convinced that everything is working just fine. The fact that wee lose data every now and then is consistently blamed on applications that have been in place and operational without any issues for many years.

  • (cs) in reply to Nagesh
    Nagesh:
    Jaime:
    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.

    jaime, in C I remember we always are told to throw exception to the highest caller or was that C++? i m having memory trubles.

    I've got bad news for you... C doesn't support exceptions at all.
  • Simon (unregistered) in reply to Gunslinger
    Gunslinger:
    Your facts and logic are flawed. A person who writes good code will suddenly write bad code just because they get a degree?

    No, but everyone writes bad code. They may think it's good code at the time, but come back to it in a year's time, and they may think differently...

  • (cs) in reply to Abso
    Abso:
    Jaime:
    Nagesh:
    (trolling)
    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.
    It's almost like C and VB are two very different languages with different purposes.
    ... and apparently held to two very different standards. My comment was directed at the general attitude of considering everything that VB does to be bad, while simultaneously considering the same thing good in C.
  • (cs) in reply to Gunslinger
    Gunslinger:
    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.

    Your facts and logic are flawed. A person who writes good code will suddenly write bad code just because they get a degree?

    People who learn how to write code by getting immediate hands-on experience maintaining an existing system, learning to program by imitation, are frequently better at writing computer programs than those who have learnt in an academic environment where the examples of code being generated are perhaps artificial and divorced from real-world apps.

    It is also often the case that graduates of computer software courses have handed in assignments which may have been the result of collaborative effort, thereby not providing a truly honest appraisal of the ability of the student.

    When that graduate appears on the doorstep of a place of industry, it is more likely that the reputation of that graduate will be sufficient to ensure that the task he/she is initially assigned will be more demanding than that of the new starter mentioned above. Hence the chances of that new graduate making a less than successful job of the task assigned are that much higher.

    Hence the reputation for CS graduates to be worth less than those who have learned their craft the hard way. Whether these things are generally true or not I can't say - but the colleagues of mine with the fanciest degrees and diplomas in computer-related disciplines have often been those whose code is of lowest quality.

  • (cs)

    Ah,

    On Error Resume Next
    , the bane of competent programmers everywhere. I have nightmares of slogging through an absolute cesspit of Classic ASP w/VBScript where every one of the 1000+ pages had that blasphemy plastered across the top, allowing the "senior developer" to merrily hack his way through trial and error. Try something, whoops that didn't output, let's try something else... viola, instant application! Many cases removing said blasphemy would cause the page to stop functioning because there were several cases where the "senior developer" had been calling methods on objects before the object was actually instantiated. I still have nightmares thinking of that code because trying to fix it (not even rewrite the slop) would have taken, I estimated, about 3 years.

  • (cs) in reply to Nagesh
    Nagesh:
    Matt Westwood:
    Something like this bit us on the ankles recently. Our in-house signature app uses a 3rd-party piece of s...oftware called "lex" or something which makes some stuff easier, apparently.

    We recently upgraded to a new version of our in-house app. Ran it, it exited immediately (within the first few seconds). No error messages, no logs, no nothing to help us. Embarrassing as we were on the client's site at the time. Back in the office the software dev guys pondered it, then suggested we install a version of lex.jar from a few versions previous. This we did. Excellent - it sent a message to the log we'd been expecting to see something in to the effect that the jre was off kilter - and we could work out what had gone wrong from there.

    The WTF, of course, is that this later version of lex.jar no longer writes out its helpful stack traces to the logger. We know now to include "lex.jar_old" to our environment so we can swap it in as needs be when the s...oftware hits the fan again.

    Come on, say it, "the real WTF is using java". Sorry, but there we are, that's what we use, it's what I do to make money.

    Sorry,but java's superiority is unmatched and style is also good.

    Indeed. I love java, despite its perceived flaws. Never got on with C. Ho hum.

  • (cs) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    Ah,
    On Error Resume Next
    , the bane of competent programmers everywhere. I have nightmares of slogging through an absolute cesspit of Classic ASP w/VBScript where every one of the 1000+ pages had that blasphemy plastered across the top, allowing the "senior developer" to merrily hack his way through trial and error. Try something, whoops that didn't output, let's try something else... viola, instant application! Many cases removing said blasphemy would cause the page to stop functioning because there were several cases where the "senior developer" had been calling methods on objects before the object was actually instantiated. I still have nightmares thinking of that code because trying to fix it (not even rewrite the slop) would have taken, I estimated, about 3 years.

    "... viola, instant application!..."

    Another one for the orchestra pit, Igor ...

    http://en.wiktionary.org/wiki/voil%C3%A0

    now go and learn it.

  • (cs) in reply to Matthew Vines
    Matthew Vines:
    Nagesh:
    Niten:
    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.

    Don Knuth?

    Need to think of 3 others, though.

  • Optimus Dime (unregistered) in reply to Matt
    Matt:
    With out project, it takes "The Vista Fix" a step further. There is a requirement that every user interaction, MUST be enclosed in a try/catch block that dutifly hides all errors from ever being shown to the user. We instead log the error to an internal table. Never mind that no one ever looks at the table. What caused the error makes no difference - corrupt data? Just trap and log it - then dutifly ignore it. We're not talking about a few error per week - we're talking several thousand a day. The end user must never be allowed to know that an error occurred. The end result is management is now entirely convinced that everything is working just fine. The fact that wee lose data every now and then is consistently blamed on applications that have been in place and operational without any issues for many years.
    I think I work where you do...

    /captcha: minim ...um

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    "... viola, instant application!..."

    Another one for the orchestra pit, Igor ...

    http://en.wiktionary.org/wiki/voil%C3%A0

    now go and learn it.

    Not the Orchestra Pit! Anything but that! I'll take On Error Resume Next over the Orchestra Pit!

  • Chris (unregistered) in reply to Craig
    Craig:
    I figured that maybe The Vista Fix was that the software uninstalled Vista and installed Windows XP.
    Or preferably 2000.
  • Abso (unregistered) in reply to Jaime
    Jaime:
    Abso:
    Jaime:
    Nagesh:
    (trolling)
    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.
    It's almost like C and VB are two very different languages with different purposes.
    ... and apparently held to two very different standards. My comment was directed at the general attitude of considering everything that VB does to be bad, while simultaneously considering the same thing good in C.
    Well, I haven't much experience with VB, but it seems the problem here isn't something that VB does, it's the disabling of something VB does (ie fancy error handling).

    As for the pattern this would force being considered good in C: There is a difference between disabling a tool and not having it in the first place.

    Plus, with the code actually under discussion, it seems doubtful that error codes were being checked after every call (or ever). (Not that that never happens in C.)

  • Rob (unregistered) in reply to Jaime
    Jaime:
    Nagesh:
    jaime, in C I remember we always are told to throw exception to the highest caller or was that C++? i m having memory trubles.
    I've got bad news for you... C doesn't support exceptions at all.

    setjmp / longjmp. So yeah, it does.

  • Gary Olson (unregistered) in reply to Jeff
    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?

    Tequila shooters. Then the user can't see the errors, the user can't understand the data, and the inverse function of the tequila infusion will create a self correcting system.

    Get off my barstool, kid.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    Gunslinger:
    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.

    Your facts and logic are flawed. A person who writes good code will suddenly write bad code just because they get a degree?

    People who learn how to write code by getting immediate hands-on experience maintaining an existing system, learning to program by imitation, are frequently better at writing computer programs than those who have learnt in an academic environment where the examples of code being generated are perhaps artificial and divorced from real-world apps.

    It is also often the case that graduates of computer software courses have handed in assignments which may have been the result of collaborative effort, thereby not providing a truly honest appraisal of the ability of the student.

    When that graduate appears on the doorstep of a place of industry, it is more likely that the reputation of that graduate will be sufficient to ensure that the task he/she is initially assigned will be more demanding than that of the new starter mentioned above. Hence the chances of that new graduate making a less than successful job of the task assigned are that much higher.

    Hence the reputation for CS graduates to be worth less than those who have learned their craft the hard way. Whether these things are generally true or not I can't say - but the colleagues of mine with the fanciest degrees and diplomas in computer-related disciplines have often been those whose code is of lowest quality.

    It's true - we haven't yet hired a guy with a CS degree. I will post a comment here once one of them passes the fizzbuzz test (which I am hoping will be this week. I've got a candidate I really like, and he has a masters).

  • Derek (unregistered) in reply to Nagesh

    I've used this in some VBS scripts before. I added my own error handler such as "if Err.Number <> 0 Then" and added error handling code. Of course, in VB6 you can have it go to a line or label.

  • (cs) in reply to Abso
    Abso:
    Jaime:
    Abso:
    Jaime:
    Nagesh:
    (trolling)
    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.
    It's almost like C and VB are two very different languages with different purposes.
    ... and apparently held to two very different standards. My comment was directed at the general attitude of considering everything that VB does to be bad, while simultaneously considering the same thing good in C.
    Well, I haven't much experience with VB, but it seems the problem here isn't something that VB does, it's the disabling of something VB does (ie fancy error handling).

    As for the pattern this would force being considered good in C: There is a difference between disabling a tool and not having it in the first place.

    Plus, with the code actually under discussion, it seems doubtful that error codes were being checked after every call (or ever). (Not that that never happens in C.)

    Fancy error handling? The extent of VB6 error handling fanciness is to jump to a line label in the same procedure. If no error handler is defined, then it shows the stock error message and quits the application. I'd hardly call that fancy or even desirable. You get forced to choose between two hacks -- either put boiler plate code in every procedure ever written, or handle errors C-style. Going with C-style error handling is no worse than the alternative. On Error Resume Next got a bad reputation because a lot of programmers didn't check their error codes.

    The double-standard is that when VB programmers forget to check their error codes, VB is a bad tool. When C programmers forget, C remains blame-free.

  • (cs) in reply to Derek
    Derek:
    I've used this in some VBS scripts before. I added my own error handler such as "if Err.Number <> 0 Then" and added error handling code. Of course, in VB6 you can have it go to a line or label.

    Well, that's the proper way to use it. But most people who use it just plaster it at the top of every code file and then don't even bother to check any errors, they just hack away.

  • moz (unregistered) in reply to Jaime
    Jaime:
    The double-standard is that when VB programmers forget to check their error codes, VB is a bad tool. When C programmers forget, C remains blame-free.
    You sound like someone who has never tried to program in C. If you get chance, find a C compiler and experiment with the following code:
    #include <stdio.h>
    int main() {return puts(gets(0));}
    Before you do, I should just add:

    This code is provided "as is" without warranty of any kind, either expressed or implied. In particular, I disclaim all liability for any direct, indirect or consequential loss, damage, injury or death resulting from its use.

  • no-one (unregistered) in reply to Jaime
    Jaime:
    Abso:
    Jaime:
    Abso:
    Jaime:
    Nagesh:
    (trolling)
    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.
    It's almost like C and VB are two very different languages with different purposes.
    ... and apparently held to two very different standards. My comment was directed at the general attitude of considering everything that VB does to be bad, while simultaneously considering the same thing good in C.
    Well, I haven't much experience with VB, but it seems the problem here isn't something that VB does, it's the disabling of something VB does (ie fancy error handling).

    As for the pattern this would force being considered good in C: There is a difference between disabling a tool and not having it in the first place.

    Plus, with the code actually under discussion, it seems doubtful that error codes were being checked after every call (or ever). (Not that that never happens in C.)

    Fancy error handling? The extent of VB6 error handling fanciness is to jump to a line label in the same procedure. If no error handler is defined, then it shows the stock error message and quits the application. I'd hardly call that fancy or even desirable. You get forced to choose between two hacks -- either put boiler plate code in every procedure ever written, or handle errors C-style. Going with C-style error handling is no worse than the alternative. On Error Resume Next got a bad reputation because a lot of programmers didn't check their error codes.

    The double-standard is that when VB programmers forget to check their error codes, VB is a bad tool. When C programmers forget, C remains blame-free.

    Incorrect. VB6 exceptions will bubble up the call stack looking for an active handler. Only if the exception reaches the top of the stack, or a break in it, without being handled will the application quit.

  • (cs) in reply to topspin
    topspin:
    Matthew Vines:
    Nagesh:
    Niten:
    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.

    Don Knuth?

    Don Knuth himself fully expects his code to have bugs in it. If you go to his homepage you can even download the errata.
  • (cs) in reply to no-one
    no-one:
    Jaime:
    Abso:
    Jaime:
    Abso:
    Jaime:
    Nagesh:
    (trolling)
    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.
    It's almost like C and VB are two very different languages with different purposes.
    ... and apparently held to two very different standards. My comment was directed at the general attitude of considering everything that VB does to be bad, while simultaneously considering the same thing good in C.
    Well, I haven't much experience with VB, but it seems the problem here isn't something that VB does, it's the disabling of something VB does (ie fancy error handling).

    As for the pattern this would force being considered good in C: There is a difference between disabling a tool and not having it in the first place.

    Plus, with the code actually under discussion, it seems doubtful that error codes were being checked after every call (or ever). (Not that that never happens in C.)

    Fancy error handling? The extent of VB6 error handling fanciness is to jump to a line label in the same procedure. If no error handler is defined, then it shows the stock error message and quits the application. I'd hardly call that fancy or even desirable. You get forced to choose between two hacks -- either put boiler plate code in every procedure ever written, or handle errors C-style. Going with C-style error handling is no worse than the alternative. On Error Resume Next got a bad reputation because a lot of programmers didn't check their error codes.

    The double-standard is that when VB programmers forget to check their error codes, VB is a bad tool. When C programmers forget, C remains blame-free.

    Incorrect. VB6 exceptions will bubble up the call stack looking for an active handler. Only if the exception reaches the top of the stack, or a break in it, without being handled will the application quit.

    Explain where I am incorrect. You say "Only if the exception reaches the top of the stack, or a break in it, without being handled" and I say "If no error handler is defined" -- same thing. I don't recall saying that it won't bubble up and I don't see any reference to "no error handler" being limited to the current function. You still need to define a handler at the proper level because the Resume Next statement is scoped to the function it is issued in.

  • (cs) in reply to moz
    moz:
    Jaime:
    The double-standard is that when VB programmers forget to check their error codes, VB is a bad tool. When C programmers forget, C remains blame-free.
    You sound like someone who has never tried to program in C. If you get chance, find a C compiler and experiment with the following code:
    #include <stdio.h>
    int main() {return puts(gets(0));}
    Before you do, I should just add:

    This code is provided "as is" without warranty of any kind, either expressed or implied. In particular, I disclaim all liability for any direct, indirect or consequential loss, damage, injury or death resulting from its use.

    I never said that C can't be used for evil or that the error handling conventions in C are sane. I said that the code you posted would be blamed on the programmer, not the language. However, any bug in VB code is usually used as a platform to say "The real WTF is VB".

    BTW, I'm still trying to figure out your rationale for saying that I've never programmed in C. I can see the guy who mentioned longjmp saying it, because he actually noted a feature of the C Standard Library that I strategically ignored (it's a library function, not a language feature). However your argument seems to be: You mentioned that C programmers sometimes forget to check the return code of functions, here's some C code that doesn't check the return codes of anything and recklessly uses a zero pointer, ha - got you.

  • No, Not That Guy (unregistered) in reply to hoodaticus
    hoodaticus:
    Matt Westwood:
    Gunslinger:
    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.

    Your facts and logic are flawed. A person who writes good code will suddenly write bad code just because they get a degree?

    People who learn how to write code by getting immediate hands-on experience maintaining an existing system, learning to program by imitation, are frequently better at writing computer programs than those who have learnt in an academic environment where the examples of code being generated are perhaps artificial and divorced from real-world apps.

    It is also often the case that graduates of computer software courses have handed in assignments which may have been the result of collaborative effort, thereby not providing a truly honest appraisal of the ability of the student.

    When that graduate appears on the doorstep of a place of industry, it is more likely that the reputation of that graduate will be sufficient to ensure that the task he/she is initially assigned will be more demanding than that of the new starter mentioned above. Hence the chances of that new graduate making a less than successful job of the task assigned are that much higher.

    Hence the reputation for CS graduates to be worth less than those who have learned their craft the hard way. Whether these things are generally true or not I can't say - but the colleagues of mine with the fanciest degrees and diplomas in computer-related disciplines have often been those whose code is of lowest quality.

    It's true - we haven't yet hired a guy with a CS degree. I will post a comment here once one of them passes the fizzbuzz test (which I am hoping will be this week. I've got a candidate I really like, and he has a masters).

    Lest software developers feel unique, this is also true for hardware technicians. Can't count the number of times I've had to show someone with a fresh cert or degree how to use a voltmeter or even something as painfully simple as a magnetizer.

  • (cs) in reply to No, Not That Guy
    No:
    hoodaticus:
    Matt Westwood:
    Gunslinger:
    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.

    Your facts and logic are flawed. A person who writes good code will suddenly write bad code just because they get a degree?

    People who learn how to write code by getting immediate hands-on experience maintaining an existing system, learning to program by imitation, are frequently better at writing computer programs than those who have learnt in an academic environment where the examples of code being generated are perhaps artificial and divorced from real-world apps.

    It is also often the case that graduates of computer software courses have handed in assignments which may have been the result of collaborative effort, thereby not providing a truly honest appraisal of the ability of the student.

    When that graduate appears on the doorstep of a place of industry, it is more likely that the reputation of that graduate will be sufficient to ensure that the task he/she is initially assigned will be more demanding than that of the new starter mentioned above. Hence the chances of that new graduate making a less than successful job of the task assigned are that much higher.

    Hence the reputation for CS graduates to be worth less than those who have learned their craft the hard way. Whether these things are generally true or not I can't say - but the colleagues of mine with the fanciest degrees and diplomas in computer-related disciplines have often been those whose code is of lowest quality.

    It's true - we haven't yet hired a guy with a CS degree. I will post a comment here once one of them passes the fizzbuzz test (which I am hoping will be this week. I've got a candidate I really like, and he has a masters).

    Lest software developers feel unique, this is also true for hardware technicians. Can't count the number of times I've had to show someone with a fresh cert or degree how to use a voltmeter or even something as painfully simple as a magnetizer.

    Good call. Are "sandwich courses" still on offer to students? Industrially-sponsored degree courses in which academic terms are alternated with periods of direct industry apprenticeships. You end up with a generation of electronic engineering graduates who know how to use a soldering iron and even (in extreme cases) welding equipment. Happy days.

  • (cs) in reply to hoodaticus
    hoodaticus:
    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.
    or in
    On Error Goto Errorhandler
    ' Do stuff
    Goto End
    

    Errorhandler: On Error Resume Next ' Log error

    End: ' Do Clean up

  • Eskil (unregistered)

    There were tons and tons and more tons of those in an order system that I maintained at a previous employer. They would obvioulsy produce all kinds of seemingly completely random results, and they were a complete pain to try and fix

    We kept finding bugs that had been there since the application was brand new, but since the application just resumed the next line when the Sub crashed, they had never been noticed.

    I'm no longer with that company.

  • WhoCare (unregistered) in reply to Nagesh
    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.

    You realized that CS degree are not the only one giving "structured thinking", or, for what it matters, programming lessons ?

  • illtiz (unregistered) in reply to Matthew Vines
    Matthew Vines:
    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.

    I demand this be turned blue, Alex.

  • Gunslinger (unregistered) in reply to Chris
    Chris:
    Craig:
    I figured that maybe The Vista Fix was that the software uninstalled Vista and installed Windows XP.
    Or preferably 2000.

    God, no. XP is vastly superior to 2000.

Leave a comment on “The Vista Fix”

Log In or post as a guest

Replying to comment #:

« Return to Article