• Prime Mover (unregistered)

    But that's what the Garbage Collector is for, surely?

  • WTFGuy (unregistered)
    try {
      this.initializeConfig(this.configFile);
    } catch (NotFristException e) {
      // something went terrible wrong... I must be seecnod.
      // but we go on, since
      // following errors will be thrown.
    }
    if(!!this.NotInitialized) throw new Exception("somethng completely unkown went Wrong");
    // much better!!
    
  • dusoft (unregistered)

    It's called "bubble downwards pattern". You just let your exception bubble down.

  • some guy (unregistered)

    Seems very considerate to me. All that error handling logic off-screen really should get some use.

  • Pabz (unregistered)

    It's perfect blame shifting in a toxic environment. When someone else doesn't handle the exception or something else goes wrong in their code as a result, they will get the blame for creating the bug!

  • (nodebb)

    My cow-orkers write such code without the comments shown in the article. And sometimes even more subtler: they do "correct" initialization if an interger was configured to 2 specific values, but do not complain for any other of those some 4 billion possible values. Much much later on (minutes after starting the program), some unexplainable NullPointerExceptions happen...

  • (nodebb)

    My brother is in real estate and in the beginning of his career, he bought a few run-down properties. One time, it was a dead-beat tenant "family" who left a terrible mess.

    He said he'll never forget lifting the carpet to take it out to the dumpster, and finding a few chicken bones under it.

  • WTFGuy (unregistered)

    @Mr. TA Better chicken bones than some of the grislier alternatives.

    Although I do wonder what your story has to do with anti-patterns in exception handling. I'm not complaining, merely curious. :)

  • NotAThingThatHappens (unregistered)

    Maybe 'ADW' is service.

    The customer said "We don't like your software, ADW is too unreliable." The boss said: "Fix it, I don't want to see ADW anymore." Programmer said: "Can't fix it, we don't own ADW." The boss said: "Fix it"

    This is the result, ADW no longer fails.

  • NotAThingThatHappens (unregistered)

    Maybe 'ADW' is service.

    The customer said "We don't like your software, ADW is too unreliable." The boss said: "Fix it, I don't want to see ADW anymore." Programmer said: "Can't fix it, we don't own ADW." The boss said: "Fix it"

    This is the result, ADW no longer fails.

  • NotAThingThatHappens (unregistered)

    Sorry for double post, Captcha is unreliable.

    REALLY, it said 'Captcha invalid', so I tried again. Maybe next time, I should continue without checking the result, who cares about dataloss anyway?

  • dpm (unregistered) in reply to WTFGuy

    I cannot help but admire the double negative test, especially against a variable named negatively.

  • (nodebb)

    If only silently ignoring exceptions was a new anti-pattern :/

  • (nodebb) in reply to NotAThingThatHappens

    You should have just ignored the "error" and carried on. I'm sure, if there were any problems they would have been caught by somebody else later.

  • (nodebb)

    No , it isn't ... and don't call me Shirley

  • (nodebb) in reply to WTFGuy

    I thought it was kind of obvious, frankly. The analogy of "sweeping things under the rug". Albeit, perhaps more of a literary one than a meaningful one.

  • Yikes (unregistered)

    Don't let a good exception go to waste! Invest it and you'll soon find yourself with more exceptions than you can catch!

  • WTFGuy (unregistered)

    @Mr. TA Sorry. Color me excessively literal today.

  • FTB (unregistered)

    Ah, memories. Who doesn't remember typing "On Error Resume Next" in Visual BASIC?

    (me, for one, I never used it)

  • Craig (unregistered) in reply to FTB
    Comment held for moderation.
  • suraj (unregistered)
    Comment held for moderation.
  • suraj (unregistered)
    Comment held for moderation.

Leave a comment on “New Anti-Pattern Just Dropped”

Log In or post as a guest

Replying to comment #562661:

« Return to Article