- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
This is what happens when you don't have proper callback function pointers.
Admin
This is what happens when you develop the Golden Hammer.
Admin
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.
Admin
The real WTF is that there is no real WTF with this post.
Admin
implements Listener?
Admin
The fake WTF is that it's not using VB.
Admin
The non-sequiter WTF is a dolphin eating cake.
Admin
The cake is a lie.
Admin
The surreal WTF is a bathtub full of power tools painted orange.
Admin
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".
Admin
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".
Admin
The Boring WTF is that someone thinks a different language would have made a difference in the code.
Admin
Knives not knifes
Admin
Two problems. Two identical posts. A WTF about the WTF. Makes sense to me! :)
Admin
I have this strong feeling that the implemented interfaces all look something like this:
public interface MessageListener { public void messageRecieved(Message msg); }
Admin
...
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.
Admin
Admin
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).
Admin
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.
Admin
Admin
looks like a very good companion - listens alot and talks nothing
Admin
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.
Admin
neither can Java afford the complexity costs of closures currently ... nor forces Java you to program like this.
Admin
Holy responsibility, Batman!
Admin
Admin
The REAL wtf is that I'm pretty sure at least a few of you miserable jerks has been with a woman.
Admin
What's the problem? We're all going to die anyway...
Admin
What's the problem? We're all going to die anyway...
Admin
No WTF: radio!
Admin
(emphasis added) WTF?
Admin
Am I the only one here who thinks that this looks like Mediator Pattern. Nothing in GoF can ever be a WTF.
Admin
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!"
Admin
...in Soviet Russia Java forces YOU to program!!
Admin
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.