Article 5ZMAN CodeSOD: New Anti-Pattern Just Dropped

CodeSOD: New Anti-Pattern Just Dropped

by
Remy Porter
from The Daily WTF on (#5ZMAN)

Linda discovered a new anti-pattern, helpfully explained with comments.

try { this.initializeConfig(this.configFile);} catch (ADWException e) { // something went terrible wrong... but we go on, since // following errors will be thrown.}

I'll call this the delayed catch pattern. We know something went wrong, and in this example, we seem to have a mildly specific idea of what went wrong, based on the exception type. We know that it's impossible for the program to continue, but we don't complain. We just ignore the exception and wait for somebody else to notice it, like the person who saw the mess in the breakroom, but are pretending they didn't, so they don't have to clean it up. They'll wait until somebody else needs coffee more than they do, and then act surprised when they discover Carole from down the hall had to spend 30 minutes cleaning up a mess left by god knows who. "Oh no," they'd say with all the sincerity of a used-car salesman, "I walked by but didn't notice the mess. I would have totally stopped and helped if I'd have noticed! Anywho, let me just grab some coffee quick, I've got a meeting in five."

otter-icon.png [Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today! TheDailyWtf?d=yIl2AUoC8zA
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments