Comment On Classic WTF: Implements ISwissArmyKnife

Although I've taken the rest of the year off, I wanted to share a few fun classics this week. "Implements ISwissArmyKnife" was originally published on 2005-02-24, and never seems to grow old... [expand full text]
« PrevPage 1Next »

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 08:19 • by henke37
This is what happens when you don't have proper callback function pointers.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 08:23 • by Quicksilver
This is what happens when you develop the Golden Hammer.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 08:29 • by Andrew (unregistered)
Looks like UI code - in which case, it's not so bad. It's a *bold* attempt to try to get Java to behave at least somewhat nicely. henke37 has the right answer.

Not to turn this into a language war, but C# gets it right with delegates and events.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 08:54 • by Mark (unregistered)
The real WTF is that there is no real WTF with this post.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 08:56 • by JonF (unregistered)
implements Listener?

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 09:28 • by Otterdam
The fake WTF is that it's not using VB.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 09:37 • by dude (unregistered)
The non-sequiter WTF is a dolphin eating cake.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 09:56 • by sweet (unregistered)
168556 in reply to 168555
The cake is a lie.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 09:56 • by Mr Ascii
The surreal WTF is a bathtub full of power tools painted orange.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 10:09 • by dsp (unregistered)
The REAL WTF here is that the title of the WTF reads "Classic WTF: Implements ISwissArmyKnife". I see two problems with this title.

First: You've got a syntax error here. "Implements" should be "implements" (no capital i).
Second: Prepending an 'I' or any other prefix to indicate a type to a class name or interface is considered bad practice in Java and violates the Sun Java naming conventions.

So the real title should be "Classic WTF: implements SwissArmyKnife".

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 10:09 • by dsp (unregistered)
The REAL WTF here is that the title of the WTF reads "Classic WTF: Implements ISwissArmyKnife". I see two problems with this title.

First: You've got a syntax error here. "Implements" should be "implements" (no capital i).
Second: Prepending an 'I' or any other prefix to indicate a type to a class name or interface is considered bad practice in Java and violates the Sun Java naming conventions.

So the real title should be "Classic WTF: implements SwissArmyKnife".

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 10:22 • by clively
168563 in reply to 168551
Andrew:
Not to turn this into a language war, but C# gets it right with delegates and events.


The Boring WTF is that someone thinks a different language would have made a difference in the code.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 10:26 • by Tigger (unregistered)
Knives not knifes

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 10:48 • by Lars Vargas
168566 in reply to 168560
Two problems. Two identical posts. A WTF about the WTF. Makes sense to me! :)

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 10:50 • by Dan Krüsi (unregistered)
I have this strong feeling that the implemented interfaces all look something like this:

public interface MessageListener {
public void messageRecieved(Message msg);
}

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 12:19 • by Rob (unregistered)
168577 in reply to 168549
...

How would that make it any better? The problem is clearly that this object has far too much responsibility than it should. 'Proper callback function pointers' won't fix that - only better design will fix that.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 12:31 • by werdan
168578 in reply to 168556
sweet:
The cake is a lie.

And there is no quack.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 13:32 • by James (unregistered)
Still not seeing the problem -- like another poster said, sounds like UI code. You've got your main window in your application waiting for input, like a secretary with 14 phones at her desk. Maybe the design should be split up with multiple secretaries answering smaller groups of phones, but maybe the phones don't ring that often and the 14-line receptionist is the best answer to the problem. Without a bit more body in the "//snip", I can't accept this one as a WTF (yet).

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 14:10 • by A raptor (unregistered)
All these listeners and nobody's going to make a joke about women?

Also, the real WTF is that global warming will kill us all and nobody's doing anything about it.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 15:37 • by nwbrown
168591 in reply to 168581
James:
Still not seeing the problem -- like another poster said, sounds like UI code. You've got your main window in your application waiting for input, like a secretary with 14 phones at her desk. Maybe the design should be split up with multiple secretaries answering smaller groups of phones, but maybe the phones don't ring that often and the 14-line receptionist is the best answer to the problem. Without a bit more body in the "//snip", I can't accept this one as a WTF (yet).

The problem isn't that the developer wrote it this way, its that Java requires it to be written this way. And the fact that people seem to think there couldn't be a better way is one of the best arguments that closures need to be implemented in Java.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 16:01 • by G (unregistered)
looks like a very good companion - listens alot and talks nothing

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 18:40 • by Franz Kafka (unregistered)
168599 in reply to 168577
Rob:
...

How would that make it any better? The problem is clearly that this object has far too much responsibility than it should. 'Proper callback function pointers' won't fix that - only better design will fix that.


My minimal fix would involve a bunch of private classes that implement various interfaces and talk to the object in question. But yeah, you gotta split that up a bit.

Re: Classic WTF: Implements ISwissArmyKnife

2007-12-31 22:35 • by Quicksilver
168606 in reply to 168591
neither can Java afford the complexity costs of closures currently ...
nor forces Java you to program like this.

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-01 06:20 • by Fatal_Exception (unregistered)
Holy responsibility, Batman!

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-01 09:55 • by Mario (unregistered)
168629 in reply to 168560
dsp:
The REAL WTF here is that the title of the WTF reads "Classic WTF: Implements ISwissArmyKnife". I see two problems with this title.

//snip

So the real title should be "Classic WTF: implements SwissArmyKnife".
I think the title is in VB.Net ...

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-01 18:38 • by Kerin (unregistered)
168645 in reply to 168549
The REAL wtf is that I'm pretty sure at least a few of you miserable jerks has been with a woman.

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-01 22:06 • by BillyBob (unregistered)
168654 in reply to 168585
A raptor:

Also, the real WTF is that global warming will kill us all and nobody's doing anything about it.


What's the problem? We're all going to die anyway...

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-01 22:08 • by BillyBob (unregistered)
168655 in reply to 168585
A raptor:

Also, the real WTF is that global warming will kill us all and nobody's doing anything about it.


What's the problem? We're all going to die anyway...

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-02 06:11 • by SQB
No WTF: radio!

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-03 09:57 • by Neomojo (unregistered)
168797 in reply to 168606
Quicksilver:
neither can Java afford the complexity costs of closures currently ...
nor forces Java you to program like this.


(emphasis added)
WTF?

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-03 12:19 • by A (unregistered)
Am I the only one here who thinks that this looks like Mediator Pattern. Nothing in GoF can ever be a WTF.

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-03 13:20 • by Patrick (unregistered)
168892 in reply to 168550
Quicksilver:
This is what happens when you develop the Golden Hammer.


I used that as an attempt to provide some constructive criticism of a coworker's class, and he took it as a compliment. I said to him, "That class does quite alot, isn' that a little bit of a golden hammer?" He goes, "Yeah, isn't it neat!"

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-03 17:46 • by john (unregistered)
168948 in reply to 168606
Quicksilver:

nor forces Java you to program like this.


...in Soviet Russia Java forces YOU to program!!

Re: Classic WTF: Implements ISwissArmyKnife

2008-01-04 02:32 • by ounos (unregistered)
The (small) WTF is that the coder seems to feel obliged to pass "this" wherever a callback is required. Could use anonymous class instances that call back into private methods, not exposed on the api.

Re: Classic WTF: Implements ISwissArmyKnife

2010-12-18 09:00 • by cindy (unregistered)
find for all kinds of watches and handbags

http://replica038.com
« PrevPage 1Next »

Add Comment