When we go from language to language and platform to platform, a whole lot of “little things” change about how we write code: typing, syntax, error handling, etc. Good developers try to adapt to a new language by reading the documentation, asking experienced colleagues, and trying to follow best practices. “Certain Developers,” however, try to make the language adapt to their way of doing things.

Adrien Kunysz discovered this following code written by a “Certain Developer” who wasn’t a fan of the try...catch…finally approach called for in .NET Java development and exception handling.

   /**
    * Like calling assert(false) in C.
    */
   protected final void BUG (String msg) {
       Exception e = null;
       try { throw new Exception (); } catch (Exception c) { e = c; }
       logger.fatal (msg, e);
       System.exit (1);
   }

And I’m sure that, by commenting “Like calling assert(false) in C,” the author doesn’t mean assert.h, but means my_assert.h. After all, who is C – or any other language – to tell him how errors should be handled?

UPDATE: Fixed Typos and language. I swear, at 7:00AM this looked fine to me...