Suicidal code
Have you seen code that's so bad if it had any feeling it would trigger an EMP next to the source control server to commit suicide? Well, I have. And here is an example:
public synchronized void invoke(AbstractCommand command)
{
if (command == null) return;
remoteDoIt(command);
if (command instanceof Undo)
{
undo();
return;
}
if (command instanceof Redo)
{
redo();
return;
}
if (command instanceof Update)
{
command.doIt();
return;
}
if (command.doIt())
{
history.addLast(command);
if (redo.size() > 0)
{
redo.clear();
}
}
else
{
history.clear();
updates.clear();
}
}
To make matters worse, Undo
, Redo
and Update
are all empty "marker" interfaces. Refactor this!
2 Comments:
"EMP next to the source control server", LOL, that's funny!
Try thedailywtf.com
Post a Comment
<< Home