Tuesday, February 14, 2006

Putting Code out to Pasture: DontBeRetardedExceptions

Say you've got a Really Bad Implementation of something. You go right ahead and refactor it, but you can't be sure you've nabbed everything, so you add in a @deprecated javadoc flag and prepare to kill off the code.

Your resident specialist then proceeds to actively ignore @deprecated and make use of your old code in ever more interesting ways, duplicating functionality and causing headaches.

How do you stop it?

class Logger {
public static function debug($message) {
//Your standard debugging logger method(s)

public static function deprecated($message) {
if (Config::isTestSite()) { throw new DontBeRetardedException($message); }


function UglyCode() {
Logger::deprecated("Don't use UglyCode()");

Stops specialists in their tracks!
Post a Comment