• TheCPUWizard (unregistered)

    The "use exception not goto" to escape a method pattern...

  • Sauron (unregistered)

    Hiring the author of that code was the biggest error.

  • (nodebb)

    This is the proverbial negative of On error resume next

  • Mr Bits (unregistered)

    This is the code Wally (from the Dilbert comic strip) wrote after he famously said, "I'm gonna write me a new minivan this afternoon!"

    For those too young to understand this: https://english.stackexchange.com/questions/488178/what-does-it-mean-writing-a-minivan

  • m (unregistered)

    The once was a dev fresh from university, who got bitten trying to throw exceptions from Delphi to VB6. He was told to catch the exceptions and use return codes in the interface and then left unsupervised for months. Ever since, his code was exactly like in the article, throughout, even when there were no language boundaries involved.

    I wonder if he still does it

  • (nodebb) in reply to Mr Bits

    For those too young to understand this

    It isn't really a question of being (or not) too young(1) to get it as that understanding the reference requires the rest of the strip as context.

    (1) I did read Dilbert at least somewhat back in 1995, just barely, but this one clearly didn't stick in my mind for thirty years.

  • (nodebb)

    Ha, I again have seen similar code. Developers made proper implementations, then management came around and said "OI, when the user breaks something he get's an error, we don't want that, we want it to just go on somehow". And then the developers added tons of ON ERROR RESUME NEXT (or basically try catch) blocks and used result codes to sometimes do something sensible. Obviously the software was a big pile of garbage and it was getting replaced by a new one because the other one was beyond repair (especially since the persisted data was obviously mostly garbage by this point).

    Addendum 2024-08-20 11:07: There could be an argument to be made to say in this case the manager was the problem. Equally you could say spineless developers who just do what they were told are the issue. Personally I think it's a little bit of both.

  • Oracles (unregistered)

    Yet another case of paid by the pound code. "I need 100 lines of new code today, so I'll just add a bunch of useless exception cases and have some coffee."

  • Lurk (unregistered) in reply to MaxiTB

    I'll see your "spineless developers" with "developers in a tight job market with a family to support and a mortgage to pay."

  • (nodebb)

    Are you all familiar with the esoteric programming language, complete with tld ideal for here, https://hurl.wtf/ ? Because that programmer and that language may be an ideal match.

  • Loren Pechtel (unregistered)

    I think we are seeing somebody in authority who doesn't like the exception breaking their routine. And somebody without the power to override who understands that it should break and recreates the exception in their code.

  • löchlein deluxe (unregistered)

    Oh good grief, with the mention of "one return policy", I now have a mental image of a catch(Exception e) that then does an if-then-else-if cascade of instanceof to find out what the exception was. (I don't think Java at least would let you switch-case over classes. Oh maybe the class names. Oh deity, now I almost want to fake a submission that does that. It would have missing break statements and all.)

  • Ginssuart (unregistered) in reply to löchlein deluxe

    No need to fake it... I swear there is code like this in "our Codebase" (C#). Whenever I quit here, I will submit a hundred stupid code fragments.

  • (nodebb) in reply to Lurk

    No, you see it clearly wrong. It's "developers that can't see the bigger picture, only one step ahead and throw with their actions a whole team into possibly into a situation where they get fired but are often more like cockroaches that already have move on and therefore other people will suffer for their shortcomings" :p

  • (nodebb) in reply to löchlein deluxe

    I don't think Java at least would let you switch-case over classes.

    Normally no, but with sealed class hierarchies and the new pattern matching stuff you can do that. You wouldn't usually do that with exceptions.

Leave a comment on “Exceptional Control”

Log In or post as a guest

Replying to comment #:

« Return to Article