Overloaded Help

« Return to Article
  • Bobby tables 2010-10-20 09:48
    This is silly. Clearly the sort of thing should be done with a for loop.
  • MP 2010-10-20 09:48
    Amazing. I did this when I first heard about programming but had never read a book or taken a class. I was 12 though.

    First.
  • MP 2010-10-20 09:49
    Well maybe second. =(
  • Candy 2010-10-20 09:49
    Ooh... he future-proofed it too!

    Actually, YAGNI. Remove all, recompile, put back those you were using. That should remove nearly all of them. Then tell him to stop making dead code.
  • Xenon Xavior 2010-10-20 09:49
    The best would be if setRecData with 23 arguments went and did something just slightly different from the rest. It could really weed out the men from the boys 5 years down the road when this piece of code was causing errors.
  • Alex 2010-10-20 09:49
    The REAL WTF is that the methods don't go up to 40. 40 rec data's is an absolute minimum for me.
  • Markp 2010-10-20 09:50
    Time to switch to Java 1.5+? Unfortunately switching these to varargs wouldn't maintain binary compatibility with any compiled code already calling them.
  • Max Peck 2010-10-20 09:53
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!

    -Max :D
  • Sam Sneed 2010-10-20 09:54
    ...and he didn't code this via copy/paste either.
  • Oscaruzzo 2010-10-20 09:54
    Throws Exception???
  • akatherder 2010-10-20 09:55
    Xenon Xavior:
    The best would be if setRecData with 23 arguments went and did something just slightly different from the rest. It could really weed out the men from the boys 5 years down the road when this piece of code was causing errors.


    Anyone who actually uses these functions deserves exactly what they get if there is a bug in them.
  • J 2010-10-20 09:55
    Only asked for 20? Such lack of ambition, you should have gone for a much higher number.
  • toth 2010-10-20 09:58
    You've found a magic bullet. Any time you want to get him out of the way so that you can work on code uninterrupted by him, just say "We need more overloads."
  • frits 2010-10-20 09:58
    Clearly he should've used recursion.

    BTW, Where's the definition of setRecData(String[])?
  • wtf 2010-10-20 09:59
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!

    -Max :D


    Yes, it does. This is just pathetic.
  • ImaginaryX 2010-10-20 10:00
    The goggles - they do nothing.

    Clearly this guy must have been paid by the function.

    CAPTCHA : venio - Venio, Video, Vicheo
  • Victor 2010-10-20 10:01
    public String[] bapp(String...strings) {
    return strings;
    }

    ?
  • Where's the Wtf? 2010-10-20 10:01
    But it's OPTIMIZED!
  • Luke 2010-10-20 10:01
    Do you really need a method to populate an array?
  • DeGustibusNonDisputandumEst 2010-10-20 10:02
    The real wtf is java.
  • Bob 2010-10-20 10:03
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!


    I think the intention is to prevent callers from having to do this (prior to Java 5):

    setRecData(new String[] { "a", "b", "c" });

    Instead, they can do this (for up to 30 trios of string arguments):

    setRecData("a", "b", "c");

    In Java 5, of course, all this becomes unnecessary. Perhaps some newbie looked at this code and wondered, "WTF?!" It is all perfectly logical, even if it is overkill.
  • charriu 2010-10-20 10:04
    No, you don't. Actually, he creates new arrays all over the place, so...
  • Arnold 2010-10-20 10:05
    If you ever see him walking around with an axe, run!
  • tom103 2010-10-20 10:05
    Wait... Java doesn't have variable-length argument lists ?

    In C# only one overload would have been needed:


    public void setRecData(params String[] data)
    
    {
    ...
    }
  • Matt Westwood 2010-10-20 10:08
    DeGustibusNonDisputandumEst:
    The real wtf is java.


    The real WTF is using arrays in Java.
  • SmittyBoy 2010-10-20 10:12
    TRWTF is that the article author thought we couldn't guess what code was produced the next day, and decided to paste over 4000 lines of useless text.
  • brazzy 2010-10-20 10:15
    tom103:
    Wait... Java doesn't have variable-length argument lists ?


    It *does* - that's what makes this a double-WTF. Either because he's writing all that code that is horrible and *utterly* unnecessary (you could replace those methods with a single vararg method and not even have to change any of the code that uses them). Or he hasn't heard of / isn't allowed to use a feature of Java 5, which came out in 2004.
  • veggen 2010-10-20 10:15
    tom103:
    Wait... Java doesn't have variable-length argument lists ?

    In C# only one overload would have been needed:


    public void setRecData(params String[] data)
    
    {
    ...
    }


    Of course it does. The WTF wouldn't be *that* bad if it didn't.
    ...No, wait... it would.
  • Severity One 2010-10-20 10:16
    tom103:
    Wait... Java doesn't have variable-length argument lists ?

    It does, ever since Java 5, but that's only six years old, so not everybody would have caught up with it.

    You'd do it as follows:
    public void setRecData( String ... data )
    
    {
    ...
    }

    The other WTF is the 'throws Exception', which is saying that something might go wrong in this method, but you don't know what, and you've removed the possibility for the user of the method to distinguish between compile-time and run-time exceptions.

    Yet another WTF is, as mentioned, the use of arrays. There's really no good reason to use arrays in Java, except in a few special cases (such as converting a String into a char[]).
  • Disgruntled Former Employee 2010-10-20 10:16
    Coders with this disease cannot be dealt with using sarcasm. The only way is to confront them directly. If they fail to get the point, you clean up after them by deleting their useless code and hoping they get the point or escalate the issue to management.
  • Anon 2010-10-20 10:17
    Surely you mean over 9000
  • amischiefr 2010-10-20 10:19
    And the day after that Billy was given his pink slip, and there was much rejoicing.
  • TheSHEEEP 2010-10-20 10:19
    SmittyBoy:
    TRWTF is that the article author thought we couldn't guess what code was produced the next day, and decided to paste over 4000 lines of useless text.


    Wrong.
    This code piece wouldn't be able unfold its full impression if it was cut down.
  • hasse 2010-10-20 10:20
    The TRWTF is Java ...
  • boog 2010-10-20 10:20
    Maybe it's obvious to someone else, but why "c, m, p"?
  • LANMind 2010-10-20 10:20
    And you guys laugh at VB.Net programmers?
  • BoredAtWork 2010-10-20 10:21
    SmittyBoy:
    TRWTF is that the article author thought we couldn't guess what code was produced the next day, and decided to paste over 4000 lines of useless text.


    Ahh, but who could have guessed our intrepid young hero would go to 30?
  • DeGustibusNonDisputandumEst 2010-10-20 10:24
    TRWTF is double posting
  • frits 2010-10-20 10:24
    hasse:
    The TRWTF is Java ...

    ORLY?
    dman you askimet!
  • DeaDPooL 2010-10-20 10:25
    jared needs to tell that dude to java up!
  • Me 2010-10-20 10:25
    <soapbox>
    Exactly, someone should fire this guy immediately and threaten him with severe and lasting bodily harm if he ever touches a computer again.

    Nothing but pitchforks and torches for people who write code like this.

    I have had to clean up code that went on for approx. 250 lines just to verify that one (1) session variable had been set. Don't have that code to post, but wish I did to give you guys a good laugh, facepalm, etc.
    </soapbox>
  • Wo0t 2010-10-20 10:29
    LANMind:
    And you guys laugh at VB.Net programmers?
    If they write crappy code, yes. We actually laugh at crappy programmers no matter what language they happen to be using at the time.

    There, does that make you feel better?
  • frits 2010-10-20 10:30
    Me:
    <soapbox>
    Exactly, someone should fire this guy immediately and threaten him with severe and lasting bodily harm if he ever touches a computer again.

    Nothing but pitchforks and torches for people who write code like this.

    I have had to clean up code that went on for approx. 250 lines just to verify that one (1) session variable had been set. Don't have that code to post, but wish I did to give you guys a good laugh, facepalm, etc.
    </soapbox>

    No, he should be sent to prison, since that is the place where rehabilitation occurs.
  • Zapp Brannigan 2010-10-20 10:40
    Mine goes to 11.
  • snoofle 2010-10-20 10:41
    Xenon Xavior:
    The best would be if setRecData with 23 arguments went and did something just slightly different from the rest. It could really weed out the men from the boys 5 years down the road when this piece of code was causing errors.

    You, Sir, are pure Evil!

    *bows*
  • LANMind 2010-10-20 10:42
    Wo0t:
    LANMind:
    And you guys laugh at VB.Net programmers?
    If they write crappy code, yes. We actually laugh at crappy programmers no matter what language they happen to be using at the time.

    There, does that make you feel better?


    Not unless it sparks another holy war...
  • Aasi 2010-10-20 10:42
    How about asking him to make test cases for these functions. At least we would see how easily these "helper" functions are used.
  • You Jackwagon 2010-10-20 10:42
    frits:
    Clearly he should've used recursion.

    BTW, Where's the definition of setRecData(String[])?

    Clearly you don't understand recursion.
  • frits 2010-10-20 10:49
    Clearly you don't understand sarcasm.
  • Anon 2010-10-20 10:50
    Bob:
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!


    I think the intention is to prevent callers from having to do this (prior to Java 5):

    setRecData(new String[] { "a", "b", "c" });

    Instead, they can do this (for up to 30 trios of string arguments):

    setRecData("a", "b", "c");

    In Java 5, of course, all this becomes unnecessary. Perhaps some newbie looked at this code and wondered, "WTF?!" It is all perfectly logical, even if it is overkill.


    Not sure that's much of a saving. Basically you have an extra "new String[] { " and an extra "}" to type in the first case, an extra burden that become completely insignificant as the number of arguments increases (it's a lot of extra guff for 1 argument, it's next to nothing for 30).
    Plus, you lose the ability of the caller to create the array in...I don't know....maybe a for loop instead of manually typing out 30 arguments. Or in other words, doing on the caller side what the function should be doing on the callee side.
  • Rich 2010-10-20 10:54
    Nah, by asking for 20, next week he can ask for 40 (and the week after, 60).

    Could have an office pool to bet on when the programmer finally cracks, plus a weekly pool on how many parameters he'll add that week!

    appellatio: (adj.) something that is simultaneously apropos and appalling.
  • Severity One 2010-10-20 11:00
    Me:
    I have had to clean up code that went on for approx. 250 lines just to verify that one (1) session variable had been set.

    I'm intrigued now. How can you possibly spend 250 lines to check one session variable?
  • boog 2010-10-20 11:02
    Anon:
    Bob:
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!


    I think the intention is to prevent callers from having to do this (prior to Java 5):

    setRecData(new String[] { "a", "b", "c" });

    Instead, they can do this (for up to 30 trios of string arguments):

    setRecData("a", "b", "c");

    In Java 5, of course, all this becomes unnecessary. Perhaps some newbie looked at this code and wondered, "WTF?!" It is all perfectly logical, even if it is overkill.


    Not sure that's much of a saving. Basically you have an extra "new String[] { " and an extra "}" to type in the first case, an extra burden that become completely insignificant as the number of arguments increases (it's a lot of extra guff for 1 argument, it's next to nothing for 30).
    Plus, you lose the ability of the caller to create the array in...I don't know....maybe a for loop instead of manually typing out 30 arguments. Or in other words, doing on the caller side what the function should be doing on the callee side.

    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users. Before I encountered it, if you had told me that it was possible to not be able to share projects (which simply amounts to setting a source and class path), would would not have believed you. Eclipse is everything that is wrong with Java, and its name even implies its darkness.

    Who the hell designed the interface? A transformer? Why do I need different views for browsing, editing, and debugging? No other applications work like that.

    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?
  • dkf 2010-10-20 11:08
    frits:
    Clearly you don't understand sarcasm.
    Clearly you don't understand the QUOTE button.
  • empire 2010-10-20 11:09
    TRWTF is that he committed this in one day. What was he thinking? "Oh, someone made a feature request for my useless utility library, better get busy!" He must be a robot, because no self-respecting human being would generate those 1000+ lines of unnecessary code IMMEDIATELY after a feature request.
  • Moo 2010-10-20 11:10
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. *rant*


    Well, it's good to know that PHP isn't the only thing that Eclipse totally sucks at...
  • Mark 2010-10-20 11:13
    Someone should tell this coder that there is such a thing as working too hard.
  • Airhead 2010-10-20 11:14
    DeGustibusNonDisputandumEst:
    The real wtf is java.
    No, the real wtf is PHP, even though it's not related to this article.
  • @Deprecated 2010-10-20 11:20
    boog:
    Anon:
    Bob:
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!


    I think the intention is to prevent callers from having to do this (prior to Java 5):

    setRecData(new String[] { "a", "b", "c" });

    Instead, they can do this (for up to 30 trios of string arguments):

    setRecData("a", "b", "c");

    In Java 5, of course, all this becomes unnecessary. Perhaps some newbie looked at this code and wondered, "WTF?!" It is all perfectly logical, even if it is overkill.


    Not sure that's much of a saving. Basically you have an extra "new String[] { " and an extra "}" to type in the first case, an extra burden that become completely insignificant as the number of arguments increases (it's a lot of extra guff for 1 argument, it's next to nothing for 30).
    Plus, you lose the ability of the caller to create the array in...I don't know....maybe a for loop instead of manually typing out 30 arguments. Or in other words, doing on the caller side what the function should be doing on the callee side.

    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users. Before I encountered it, if you had told me that it was possible to not be able to share projects (which simply amounts to setting a source and class path), would would not have believed you. Eclipse is everything that is wrong with Java, and its name even implies its darkness.

    Who the hell designed the interface? A transformer? Why do I need different views for browsing, editing, and debugging? No other applications work like that.

    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?


    Uhhh... My eclipse has none of those problems. Where did you get yours?

    Okay I have one issue with eclipse: the preferences are stored per-workspace. So if I start a new workspace, then all my key mappings need to be reset, and I need to turn off the $%#@ spell checker *again*.

    The Real WTF is spell checking your source code!!!

    (The workaround is to create a blank default workspace, configure it, and copy that instead of using eclipse to create a new workspace).
  • frits 2010-10-20 11:20
    dkf:
    frits:
    Clearly you don't understand sarcasm.
    Clearly you don't understand the QUOTE button.


    Nope. I've never used it before. Doy!

    Clearly you do understand hyperlinks, though.

  • Beans 2010-10-20 11:20
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    Surely all that behaviour can be changed in the config? Auto format and save behaviours are both configurable, aren't they?
  • Steve 2010-10-20 11:21
    The real WTF is that he put the commas on the left... who does that???
  • Mark 2010-10-20 11:21
    Airhead:
    DeGustibusNonDisputandumEst:
    The real wtf is java.
    No, the real wtf is PHP, even though it's not related to this article.

    I think you'll find TRWTF is VB. Also unrelated to today's article.
  • boog 2010-10-20 11:22
    Beans:
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    Surely all that behaviour can be changed in the config? Auto format and save behaviours are both configurable, aren't they?

    You would think so, but not available. It's incomprehensible, almost as if the writers are playing a massive practical joke on the Java community.
  • boog 2010-10-20 11:23
    I must say, thank you Alex for posting this code in its entirety. Though omitting the bulk of it for brevity can be easier on the eyes, much is lost in the translation.

    Presenting the monster in all its glory as you have done conveys so much more of the situation. I can almost see the immense void that takes residence in the head of its original programmer. I am in awe.
  • Mark 2010-10-20 11:24
    Steve:
    The real WTF is that he put the commas on the left... who does that???

    Agreed, that's really dumb. A comma marks the end of a clause so it should be after the clause it delimits, not before the next one on the next line. Very weird style, glad I don't work with this guy.
  • TheCPUWizard 2010-10-20 11:25
    One thing that most of the suggestions (all of them?) leave out is the compile time checking that the number of parameters is a multiple of 3....
  • iToad 2010-10-20 11:28
    Moo:
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. *rant*


    Well, it's good to know that PHP isn't the only thing that Eclipse totally sucks at...


    It kind of sucks at C++ too. Why the hell can't it compile single source code files without a mass project rebuild?
  • boog 2010-10-20 11:28
    boog (unregistered):

    <bunch of boohoo-ing about Eclipse/>

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?

    I think it was you. Maybe me. But who can tell anymore?
  • iToad 2010-10-20 11:29
    Mark:
    Someone should tell this coder that there is such a thing as working too hard.


    He probably wrote a script to generate the code automatically.
  • boog 2010-10-20 11:31
    boog:
    boog:

    <bunch of boohoo-ing about Eclipse/>

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?

    I think it was you. Maybe me. But who can tell anymore?

    Why are you replying to yourself.
  • neminem 2010-10-20 11:37
    Mark:
    I think you'll find TRWTF is VB. Also unrelated to today's article.

    If you just want to start saying that the real WTF is a random crappy language, with no relevance to today's story, why stop at VB? Why not FORTRAN? Or for that matter, Brainfuck? Or LOLCode or Whitespace?
  • egg 2010-10-20 11:38
    For the love of god and all that is holy can we please just get an:

    // ed: *snip*
  • Sutherlands 2010-10-20 11:41
    boog:
    boog:
    boog:

    <bunch of boohoo-ing about Eclipse/>

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?

    I think it was you. Maybe me. But who can tell anymore?

    Why are you replying to yourself.

    It sounds like someone doesn't understand recursion.
  • Mark 2010-10-20 11:42
    neminem:
    Mark:
    I think you'll find TRWTF is VB. Also unrelated to today's article.

    If you just want to start saying that the real WTF is a random crappy language, with no relevance to today's story, why stop at VB? Why not FORTRAN? Or for that matter, Brainfuck? Or LOLCode or Whitespace?

    I guess humor's not your strong suit.
  • Jaime 2010-10-20 11:49
    tom103:
    Wait... Java doesn't have variable-length argument lists ?

    In C# only one overload would have been needed:


    public void setRecData(params String[] data)
    
    {
    ...
    }
    Look at String.Format in the framework. It actually has overloads for one, two, and three parameters, as well as a params overload for more. The pattern in today's WTF actually has some grounding in practicality, he just screwed it up badly.
  • AquaDuck 2010-10-20 11:53
    boog:
    I must say, thank you Alex for posting this code in its entirety. Though omitting the bulk of it for brevity can be easier on the eyes, much is lost in the translation.

    Presenting the monster in all its glory as you have done conveys so much more of the situation. I can almost see the immense void that takes residence in the head of its original programmer. I am in awe.


    I agree. This is one of those things that you really need to see in full to believe.
  • danixdefcon5 2010-10-20 11:54
    TRWTF is that I can't reply 'coz something called 'Akismet' sez that I am spam. WTF?
  • danixdefcon5 2010-10-20 11:56
    Severity One:

    The other WTF is the 'throws Exception', which is saying that something might go wrong in this method, but you don't know what, and you've removed the possibility for the user of the method to distinguish between compile-time and run-time exceptions.

    This is a common trait on either lazy coders, or those migrating from .NET, where there is no such thing as a checked Exception. That architecture actively encourages the dreaded Diaper pattern; later the aforementioned coders will start throwing generic Exceptions everywhere. I've suffered from this as well!
  • Anonymous 2010-10-20 11:59
    danixdefcon5:
    TRWTF is that I can't reply 'coz something called 'Akismet' sez that I am spam. WTF?

    So Akismet gets logged-in users as well? I thought it was just us unregistered riff-raff that fell foul to the wrath of Akismet.

    The actual problem is that you are trying to post a completely legitimate comment. If you try to make your post sound a bit spammier Akismet will let it right through.
  • AquaDuck 2010-10-20 12:05
    Anonymous:
    danixdefcon5:
    TRWTF is that I can't reply 'coz something called 'Akismet' sez that I am spam. WTF?

    So Akismet gets logged-in users as well? I thought it was just us unregistered riff-raff that fell foul to the wrath of Akismet.

    The actual problem is that you are trying to post a completely legitimate comment. If you try to make your post sound a bit spammier Akismet will let it right through.


    Akismet is an equal-opportunity WTF. It treats us registered riff-raff just as badly as you unregistered scum.
  • Idiocracy Reigneth 2010-10-20 12:13
    frits:
    Me:
    <soapbox>
    Exactly, someone should fire this guy immediately and threaten him with severe and lasting bodily harm if he ever touches a computer again.

    Nothing but pitchforks and torches for people who write code like this.

    I have had to clean up code that went on for approx. 250 lines just to verify that one (1) session variable had been set. Don't have that code to post, but wish I did to give you guys a good laugh, facepalm, etc.
    </soapbox>

    No, he should be sent to prison, since that is the place where rehabilitation occurs.

    "You have been sentenced to 1 night of Rehabilitation"
  • Wo0t 2010-10-20 12:16
    boog:
    I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.
    Turn off Build Automatically.
  • boog 2010-10-20 12:19
    Wo0t:
    boog:
    I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.
    Turn off Build Automatically.

    Eclipse hates this and was not designed to work this way. If you do this, you get even more unpredictable results.
  • Mcoder 2010-10-20 12:19
    neminem:
    Mark:
    I think you'll find TRWTF is VB. Also unrelated to today's article.

    If you just want to start saying that the real WTF is a random crappy language, with no relevance to today's story, why stop at VB? Why not FORTRAN? Or for that matter, Brainfuck? Or LOLCode or Whitespace?


    That can't be. Languages that were intented to be WTFs can't be TRWTF.

    By the way, that is not relevant to today's story.
  • Larry 2010-10-20 12:25
    Mcoder:
    neminem:
    Mark:
    I think you'll find TRWTF is VB. Also unrelated to today's article.

    If you just want to start saying that the real WTF is a random crappy language, with no relevance to today's story, why stop at VB? Why not FORTRAN? Or for that matter, Brainfuck? Or LOLCode or Whitespace?


    That can't be. Languages that were intented to be WTFs can't be TRWTF.

    By the way, that is not relevant to today's story.

    TRWTF is that whooshing sound you keep hearing.
  • Matt Westwood 2010-10-20 12:26
    Steve:
    The real WTF is that he put the commas on the left... who does that???


    Commas on the left are a useful technique because then you can easily add lines without getting caught out with end effects.

    CAPTCHA: "Consequat": as a result, he defecated.
  • Design Pattern 2010-10-20 12:30
    boog:
    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better!

    Your company does not have 0$ in cash to pony up for Netbeans or IntelliJ IDEA Community Edition?

    How will they pay your wage?
  • Design Pattern 2010-10-20 12:34
    boog:

    Eclipse hates this (...)

    It is sentient?
  • Adam 2010-10-20 12:45
    I can hear the Zerg voice in the back of my head going:

    SPAWN MORE OVERLOADS!
  • Mark 2010-10-20 13:02
    Matt Westwood:
    Steve:
    The real WTF is that he put the commas on the left... who does that???


    Commas on the left are a useful technique because then you can easily add lines without getting caught out with end effects.

    CAPTCHA: "Consequat": as a result, he defecated.

    This may be useful if you're still using a display from the 70s with an 80 char line limit but I fail to see what relevance it has today. I have my IDE spread across two monitors for a total horizontal resolution of 2560 pixels and this is using a couple of cheapo 5 year old monitors, nothing special. I really don't need to worry about missing a trailing comma and most other devs of this day and age don't either. Plus, for all you IDE lovers, you'll know if you missed a comma as soon as you hit return because the auto-format will behave differently.
  • daily 2010-10-20 13:10
    toth:
    You've found a magic bullet. Any time you want to get him out of the way so that you can work on code uninterrupted by him, just say "We need to spawn more overlords."

    FTFY
  • Design Pattern 2010-10-20 13:18
    daily:
    toth:
    You've found a magic bullet. Any time you want to get him out of the way so that you can work on code uninterrupted by him, just say "We need to spawn more overlords."

    FTFY

    I for one say welcome to our old meme!

    I have overloaded your setRecData. Pray that i don't overload it any further!
  • jasmine2501 2010-10-20 13:30
    Mark:
    Steve:
    The real WTF is that he put the commas on the left... who does that???

    Agreed, that's really dumb. A comma marks the end of a clause so it should be after the clause it delimits, not before the next one on the next line. Very weird style, glad I don't work with this guy.


    You see it all the time in SQL - it allows you to delete a line or comment a line in a big column list, without causing a syntax error...

    select col1,
    col2,
    col3 --you can't comment out this line
    from table

    select col1
    ,col2
    ,col3 --now you can comment it without an error
    from table
  • toth 2010-10-20 13:36
    boog:

    Yeah, but TRWTF is Eclipse, <Eclipse bashing>


    Speaking of which, does anyone have recommendations for Python IDEs that are not Eclipse?
  • Rick 2010-10-20 13:42
    boog:

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?
    NetBeans is free.
  • Iago 2010-10-20 13:51
    boog:
    Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines.

    Seems pretty predictable and consistent to me. And it's not like you can't adjust the indentation with that big blank key at the bottom of your keyboard if you really care that much.

    boog:
    I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    This is a lie. Eclipse does not pop up any windows. It indicates errors in an unobtrusive panel at the bottom of the screen.

    boog:
    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users.

    Allow me to introduce you to the concept of "source control". If you want to share code between users, they should "check out" separate copies from a central store called a "repository". Then they can both edit it without trampling on each other's changes.

    boog:
    Why do I need different views for browsing, editing, and debugging? No other applications work like that.

    It's useful. You don't want the variable inspection panel to be visible when you aren't debugging, for example. And plenty of applications have different views for when you're doing different things. I don't hear many people complain about Outlook displaying different things for email, tasks, and calendars, or Word displaying different things for editing text and editing tables.

    Of course Emacs is superior in every way, but that doesn't mean Eclipse is totally useless.
  • Pyrexkidd 2010-10-20 13:54
    boog:
    Anon:
    Bob:
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!


    I think the intention is to prevent callers from having to do this (prior to Java 5):

    setRecData(new String[] { "a", "b", "c" });

    Instead, they can do this (for up to 30 trios of string arguments):

    setRecData("a", "b", "c");

    In Java 5, of course, all this becomes unnecessary. Perhaps some newbie looked at this code and wondered, "WTF?!" It is all perfectly logical, even if it is overkill.


    Not sure that's much of a saving. Basically you have an extra "new String[] { " and an extra "}" to type in the first case, an extra burden that become completely insignificant as the number of arguments increases (it's a lot of extra guff for 1 argument, it's next to nothing for 30).
    Plus, you lose the ability of the caller to create the array in...I don't know....maybe a for loop instead of manually typing out 30 arguments. Or in other words, doing on the caller side what the function should be doing on the callee side.

    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users. Before I encountered it, if you had told me that it was possible to not be able to share projects (which simply amounts to setting a source and class path), would would not have believed you. Eclipse is everything that is wrong with Java, and its name even implies its darkness.

    Who the hell designed the interface? A transformer? Why do I need different views for browsing, editing, and debugging? No other applications work like that.

    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?



    Uhh...

    NetBeans?
    http://netbeans.org/downloads/

    Although I entirely understand a company not wanting to pony up for free software.

    But compared to Eclipse--Well there is no comparison.

    Captcha iusto: Something you did in a past life.
  • EngleBart 2010-10-20 13:55
    boog:
    Eclipse bash

    I suspect a troll, but I will take the bait.

    I am using an ancient version of Eclipse and it has settings that will solve your every whine except the Copy/Paste. You could probably get better support answers by posting in a better location.

    (Look at the Window, Preferences, Java, Code Style, Code Formatter, button:Edit..., tab:Line Wrapping, Default indentation for wrapped lines AND Default indentation for array.) (Import/Export preferences)(Autobuild off), etc.

    Possible causes for the copy paste:
    1. Someone has installed a password stealer on your box.
    2. Your coworkers love to hear you whine and mess with basic settings on your preferences just to mess with your head. (Should we let boog copy code today? Nah!) (Next week, let's take away paste!) Solution: LOCK your computer if you cannot see your keyboard!
  • Alex Papadimoulis 2010-10-20 13:56
    boog:
    I must say, thank you Alex for posting this code in its entirety. Though omitting the bulk of it for brevity can be easier on the eyes, much is lost in the translation.

    Presenting the monster in all its glory as you have done conveys so much more of the situation. I can almost see the immense void that takes residence in the head of its original programmer. I am in awe.


    Originally, I had snipped it... but, as you mentioned, watching scrollbar size grow in your browser as the article downloads conveys exactly what it'd feel like when stumbling across. To me, the WTF wasn't so much the useless wrapping code, but the fact that the developer just kept going after 1000's of lines.
  • anon 2010-10-20 13:56
    Design Pattern:
    boog:
    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better!

    Your company does not have 0$ in cash to pony up for Netbeans or IntelliJ IDEA Community Edition?

    How will they pay your wage?


    He said "better".

    Of course, vim is free, too, so...
  • Alex Papadimoulis 2010-10-20 14:02
    TheCPUWizard:
    One thing that most of the suggestions (all of them?) leave out is the compile time checking that the number of parameters is a multiple of 3....


    I think that's a small WTF in and of itself. In a strongly-typed language like Java, it'd be trivial to build a struct or class that does the same thing, and require that as the parameters.

    setDataRecs( new DataRec( "a", "b", "c") )

    Requiring a certain multiple of parameters is a pretty confusing way to code.
  • Bryan 2010-10-20 14:05
    TRWTF is that some people just don't get sarcasm.
  • EvanED 2010-10-20 14:05
    Severity One:
    The other WTF is the 'throws Exception', which is saying that something might go wrong in this method, but you don't know what, and you've removed the possibility for the user of the method to distinguish between compile-time and run-time exceptions.

    "throws Exception" is pretty far from a WTF; there are plenty of active debates on the merits and demerits of checked exceptions. I tend to fall more on the side of checked exceptions, but the issue is far from settled.
  • Sutherlands 2010-10-20 14:11
    EvanED:
    Severity One:
    The other WTF is the 'throws Exception', which is saying that something might go wrong in this method, but you don't know what, and you've removed the possibility for the user of the method to distinguish between compile-time and run-time exceptions.

    "throws Exception" is pretty far from a WTF; there are plenty of active debates on the merits and demerits of checked exceptions. I tend to fall more on the side of checked exceptions, but the issue is far from settled.
    Whether you like checked exceptions or not, "throws Exception" is indeed a WTF. It's saying "Hey, this function could throw absolutely any exception. Or I'm just a lazy coder that couldn't put which exceptions it can actually throw. Have fun guessing which!"
  • EvanED 2010-10-20 14:13
    Sutherlands:
    EvanED:
    Severity One:
    The other WTF is the 'throws Exception', which is saying that something might go wrong in this method, but you don't know what, and you've removed the possibility for the user of the method to distinguish between compile-time and run-time exceptions.

    "throws Exception" is pretty far from a WTF; there are plenty of active debates on the merits and demerits of checked exceptions. I tend to fall more on the side of checked exceptions, but the issue is far from settled.
    Whether you like checked exceptions or not, "throws Exception" is indeed a WTF. It's saying "Hey, this function could throw absolutely any exception. Or I'm just a lazy coder that couldn't put which exceptions it can actually throw. Have fun guessing which!"

    You look at it that way, but I look at "throws Exceptions" as basically just saying "I'm making this language that demands checked exceptions into a language that doesn't, but which requires a little extra syntax on the function definitions."

    Now you can argue about how much you have to fight against the language before it becomes a WTF, but I personally don't think that particular offense is anywhere near that level.
  • Design Pattern 2010-10-20 14:19
    toth:

    Speaking of which, does anyone have recommendations for Python IDEs that are not Eclipse?

    IntelliJ IDEA, but unfortunately only in the Ultimate Edition which is not free for commercial projects.

    (It is free when using the Classroom License or the Open Source Project License).
  • frits 2010-10-20 14:20
    Sutherlands:
    Hey, this function could throw absolutely any exception.


    That's pretty much how the .Net languages and regular C++ (with exceptions turned on) operate all of the time, which I'm OK with. You shouldn't really have to worry about catching/rethrowing exceptions at every level in a library or application anyway.
  • Herby 2010-10-20 14:28
    Alex:
    The REAL WTF is that the methods don't go up to 40. 40 rec data's is an absolute minimum for me.

    This is not as bad as it seems. In biblical times, the number '40' was often used as a synonym for infinite (like 40 days and 40 nights, etc.). Given that this is intended to accommodate ALL usage, it is a much better number.

    I suspect that the original coder had no concept of infinity when they coded the first example though.

    Today's lesson: "There are three ways to code for sets: none, one, and many".
  • Design Pattern 2010-10-20 14:34
    EvanED:

    You look at it that way, but I look at "throws Exceptions" as basically just saying "I'm making this language that demands checked exceptions into a language that doesn't, but which requires a little extra syntax on the function definitions."

    If you want to make it into a language that doesn't demand checked exceptions, catch checked exceptions and wrap them into associated unchecked exceptions (which requires to define a new unchecked exception for every checked exception you want to wrap).

    Just declaring "throws Exception" is pure lazyness on the part of the implementor and makes life a hell for the user.

    In other words: It is a WTF!
  • ikke 2010-10-20 14:51
    boog:


    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!


    Copy-and-Paste code may end up here. Be glad you are prevented from "writing" it.
  • ÃÆâ€℠2010-10-20 15:03
    Herby:

    Today's lesson: "There are three ways to code for sets: none, one, many, and FILE_NOT_FOUND".

    FTFY
  • PITA 2010-10-20 15:10
    Just keep scrolling.... just keep scrolling...
  • LANMind 2010-10-20 15:13
    I absolutely love it when people fight over pointless, pedantic nonsense then leave with opinions even more idiotic than when they joined the conversation. The only way this could get better would be to somehow make it gladitorial.
  • History Teacher 2010-10-20 15:20
    toth:

    Speaking of which, does anyone have recommendations for Python IDEs that are not Eclipse?

    I seem to recall that at least about a year ago NetBeans was pretty good for Python, and is probably better today.
  • Sutherlands 2010-10-20 15:45
    frits:
    Sutherlands:
    Hey, this function could throw absolutely any exception.


    That's pretty much how the .Net languages and regular C++ (with exceptions turned on) operate all of the time, which I'm OK with. You shouldn't really have to worry about catching/rethrowing exceptions at every level in a library or application anyway.
    I'm ok with that in my functions as well. However, being forced to either catch any possible exception or being forced to declare that my function can throw any old exception (forcing the former on someone else) I'm not ok with.

    Not having checked exceptions is not a WTF. Having checked exceptions and being lazy to the point that they're strictly worse than unchecked exceptions is a WTF.
  • Sutherlands 2010-10-20 15:46
    Design Pattern:
    EvanED:

    You look at it that way, but I look at "throws Exceptions" as basically just saying "I'm making this language that demands checked exceptions into a language that doesn't, but which requires a little extra syntax on the function definitions."

    If you want to make it into a language that doesn't demand checked exceptions, catch checked exceptions and wrap them into associated unchecked exceptions (which requires to define a new unchecked exception for every checked exception you want to wrap).

    Just declaring "throws Exception" is pure lazyness on the part of the implementor and makes life a hell for the user.

    In other words: It is a WTF!
  • Roy T. 2010-10-20 15:49
    Of course in JAVA you have to do it like that, but in C# you can do this at once and have a function that has an overload for 1 to INF strings to be added to an array :).


    public string[] RecData(params string[] m)
    {
    return m;
    }


    (disclaimer: of course I'm being sarcastic)
  • cod3_complete 2010-10-20 15:58
    Moo:
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. *rant*


    Well, it's good to know that PHP isn't the only thing that Eclipse totally sucks at...


    Another thing that sucks about Eclipse is you can't open two projects (workspaces) at once without jumping thru hoops. I routinely open multiple projects in Visual Studio to add new changes to various projects through out the day. But when I had multiple projects setup thru Eclipse it just gave me an error message if I tried to open an additional "workspace". I guess those IBM guys really aren't that smart.
  • ;lkj 2010-10-20 16:00
    Alex Papadimoulis:

    setDataRecs( new DataRec( "a", "b", "c") )


    What terrifies me is the thought that it may have been intended to use it like this:

    setRecData("x", "string", "fish", "y", "int", "42");
  • ted 2010-10-20 16:03
    boog:

    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users. Before I encountered it, if you had told me that it was possible to not be able to share projects (which simply amounts to setting a source and class path), would would not have believed you. Eclipse is everything that is wrong with Java, and its name even implies its darkness.

    Who the hell designed the interface? A transformer? Why do I need different views for browsing, editing, and debugging? No other applications work like that.

    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?


    I had not heard of this software before, so I looked it up. I didn't think it could possibly be as bad as you described. Then I saw that it was the product of FOSStards, and understood your position.
  • sino 2010-10-20 16:04
    boog:
    Anon:
    Bob:
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!


    I think the intention is to prevent callers from having to do this (prior to Java 5):

    setRecData(new String[] { "a", "b", "c" });

    Instead, they can do this (for up to 30 trios of string arguments):

    setRecData("a", "b", "c");

    In Java 5, of course, all this becomes unnecessary. Perhaps some newbie looked at this code and wondered, "WTF?!" It is all perfectly logical, even if it is overkill.


    Not sure that's much of a saving. Basically you have an extra "new String[] { " and an extra "}" to type in the first case, an extra burden that become completely insignificant as the number of arguments increases (it's a lot of extra guff for 1 argument, it's next to nothing for 30).
    Plus, you lose the ability of the caller to create the array in...I don't know....maybe a for loop instead of manually typing out 30 arguments. Or in other words, doing on the caller side what the function should be doing on the callee side.

    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users. Before I encountered it, if you had told me that it was possible to not be able to share projects (which simply amounts to setting a source and class path), would would not have believed you. Eclipse is everything that is wrong with Java, and its name even implies its darkness.

    Who the hell designed the interface? A transformer? Why do I need different views for browsing, editing, and debugging? No other applications work like that.

    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?
    Could you maybe use this Eclipse to build something better? >XD
  • ted 2010-10-20 16:21
    Beans:
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    Surely all that behaviour can be changed in the config? Auto format and save behaviours are both configurable, aren't they?


    And this is how the FOSSfuck begins. You spend hours... sometimes days reading forum post after forum post and trying all levels of absurd and random things until you find something that works. If you get one problem fixed, you cause another. Etc.

    I've tried the latest popular linux distribution every 3 years or so for the last 15 years. Every time I try there is some new WTF. I spend days trying to get everything working right. I'm not sure why it strings me along for so long before I reinstall Windows... Perhaps it's because I always feel so close to getting it to work. Perhaps it's because of the time investment I've already put in it. Perhaps it's because I see all the potential, and just can't let go.

    I've concluded that those that say they "dual boot" must boot into Windows to work on something and boot into linux to fuck around in a never-ending circle jerk of WTFs. That may explain why most screenshots of a linux desktop just show overlapping windows (some translucent) of shit on top of an image of a half naked objectified woman.

    Did they ever ship a distribution with readable fonts? I don't care about howtos... Does one of the fucking distributions actually render good fonts in all windows with some sort of subpixel smoothing? And I mean right out of the box with no action on my part. Does it do proper DPI scaling if I choose? If so, then it may be time to try it again and check out the new WTFs.

    Captcha: enim - reinstalling windows and blowing away the linux partition - works like an enim for your computer.
  • phreddy 2010-10-20 16:25
    Payed by the number of lines coded?
  • plaidfluff 2010-10-20 16:29
    I just love how he explicitly states 'throws Exception' every time.
  • ANonEMouse 2010-10-20 16:43
    Is the WTF here that the coworker didnt even use own makeStringArray method?


    public void setRecData( String c01,String m01,String p01
    ,String c02,String m02,String p02
    ,String c03,String m03,String p03
    ,String c04,String m04,String p04
    ,String c05,String m05,String p05
    ,String c06,String m06,String p06
    ,String c07,String m07,String p07
    ,String c08,String m08,String p08
    ,String c09,String m09,String p09
    ,String c10,String m10,String p10
    ,String c11,String m11,String p11
    ,String c12,String m12,String p12
    ,String c13,String m13,String p13
    ,String c14,String m14,String p14
    ,String c15,String m15,String p15
    ,String c16,String m16,String p16
    ,String c17,String m17,String p17
    ,String c18,String m18,String p18
    ,String c19,String m19,String p19
    ,String c20,String m20,String p20
    ,String c21,String m21,String p21
    ,String c22,String m22,String p22
    ,String c23,String m23,String p23
    ,String c24,String m24,String p24
    ,String c25,String m25,String p25
    ,String c26,String m26,String p26
    ,String c27,String m27,String p27
    ,String c28,String m28,String p28
    ,String c29,String m29,String p29
    ,String c30,String m30,String p30
    )
    throws Exception
    {
    setRecData( makeStringArray( c01,m01,p01
    ,c02,m02,p02
    ,c03,m03,p03
    ,c04,m04,p04
    ,c05,m05,p05
    ,c06,m06,p06
    ,c07,m07,p07
    ,c08,m08,p08
    ,c09,m09,p09
    ,c10,m10,p10
    ,c11,m11,p11
    ,c12,m12,p12
    ,c13,m13,p13
    ,c14,m14,p14
    ,c15,m15,p15
    ,c16,m16,p16
    ,c17,m17,p17
    ,c18,m18,p18
    ,c19,m19,p19
    ,c20,m20,p20
    ,c21,m21,p21
    ,c22,m22,p22
    ,c23,m23,p23
    ,c24,m24,p24
    ,c25,m25,p25
    ,c26,m26,p26
    ,c27,m27,p27
    ,c28,m28,p28
    ,c29,m29,p29
    ,c30,m30,p30
    )
    );
    }


    Oh, wait, ...
  • Simon 2010-10-20 16:48
    @Deprecated:
    The Real WTF is spell checking your source code!!!


    You kidding? If only it *did* spell check the code, and not just the comments and string constants. There are badly spelled variable and method names all though our product, even in public APIs...

  • boog 2010-10-20 16:49
    ted:
    And this is how the FOSSfuck begins. You spend hours... sometimes days reading forum post after forum post and trying all levels of absurd and random things until you find something that works. If you get one problem fixed, you cause another. Etc.

    I've tried the latest popular linux distribution every 3 years or so for the last 15 years. Every time I try there is some new WTF. I spend days trying to get everything working right. I'm not sure why it strings me along for so long before I reinstall Windows... Perhaps it's because I always feel so close to getting it to work. Perhaps it's because of the time investment I've already put in it. Perhaps it's because I see all the potential, and just can't let go.

    I've concluded that those that say they "dual boot" must boot into Windows to work on something and boot into linux to fuck around in a never-ending circle jerk of WTFs. That may explain why most screenshots of a linux desktop just show overlapping windows (some translucent) of shit on top of an image of a half naked objectified woman.

    Did they ever ship a distribution with readable fonts? I don't care about howtos... Does one of the fucking distributions actually render good fonts in all windows with some sort of subpixel smoothing? And I mean right out of the box with no action on my part. Does it do proper DPI scaling if I choose? If so, then it may be time to try it again and check out the new WTFs.

    Captcha: enim - reinstalling windows and blowing away the linux partition - works like an enim for your computer.

    Hmm. It sounds like this whole Linux thing just doesn't work all that well for you. That sucks. I guess you'll just have to use Windows.

    You know what doesn't work all that well for me? Windows. So I guess I'll just have to keep using Linux.

    Funny how what works well for one person with unique personal preferences and work practices doesn't work quite the same for another person with completely different personal preferences and work practices. It's almost as if these alternatives exist just so that people can have the option to choose something that meets their individual needs.

    Interesting. Well, have a good day.
  • Simon 2010-10-20 16:56
    All those functions, and he's not bothered to write javadocs for them. Terrible - how will anyone know what they're supposed to do? :)
  • super_ 2010-10-20 16:57
    introduce him to varargs please
  • pez 2010-10-20 17:16
    Herby:
    Alex:
    The REAL WTF is that the methods don't go up to 40. 40 rec data's is an absolute minimum for me.

    This is not as bad as it seems. In biblical times, the number '40' was often used as a synonym for infinite (like 40 days and 40 nights, etc.). Given that this is intended to accommodate ALL usage, it is a much better number.

    I suspect that the original coder had no concept of infinity when they coded the first example though.

    Today's lesson: "There are three ways to code for sets: none, one, and many".


    But once you're at 40 how can you resist 41 and 42?
  • danixdefcon5 2010-10-20 17:20
    Alex Papadimoulis:
    TheCPUWizard:
    One thing that most of the suggestions (all of them?) leave out is the compile time checking that the number of parameters is a multiple of 3....


    I think that's a small WTF in and of itself. In a strongly-typed language like Java, it'd be trivial to build a struct or class that does the same thing, and require that as the parameters.

    setDataRecs( new DataRec( "a", "b", "c") )

    Requiring a certain multiple of parameters is a pretty confusing way to code.

    Yup. The fun thing about this WTF is that many commenters suggest varargs, when the OO model solves this requirement for you:

    public void setDataRecs( List<DataRec> recsToSet ) {
    /* do something here */
    }

    where DataRec is an object containing the three strings. No need to spawn more overlords ;)
  • danixdefcon5 2010-10-20 17:22
    ted:

    I had not heard of this software before, so I looked it up. I didn't think it could possibly be as bad as you described. Then I saw that it was the product of FOSStards, and understood your position.

    Ooooh!!! An anti-FOSS troll!

    Eclipse is kind of open, but it is actually the spiritual successor to IBM's Visual Age. So it is really a fairly-decent IDE that turned into something really ugly... and then got opensourced.

    Me? I prefer NetBeans.
  • danixdefcon5 2010-10-20 17:26
    EvanED:
    Severity One:
    The other WTF is the 'throws Exception', which is saying that something might go wrong in this method, but you don't know what, and you've removed the possibility for the user of the method to distinguish between compile-time and run-time exceptions.

    "throws Exception" is pretty far from a WTF; there are plenty of active debates on the merits and demerits of checked exceptions. I tend to fall more on the side of checked exceptions, but the issue is far from settled.

    The war on checked vs. unchecked Exceptions has not been settled, but one thing I do know is that "throws Exception" code breaks the code that actually cares about Exceptions, as now I have to surround the offending function call with a try/catch block. If you really, really want to do this, that's what unchecked exceptions are for.

    Trying to make Java act like C# is like programmers using goto to make C look like those old GOTO-ridden languages of yore.
  • MarkJ 2010-10-20 17:38
    Disgruntled Former Employee:
    Coders with this disease cannot be dealt with using sarcasm. The only way is to confront them directly. If they fail to get the point, you clean up after them by deleting their useless code and hoping they get the point or escalate the issue to management.
    +1
  • Somebody 2010-10-20 17:44
    Losers.

    Captcha: populus

    Populated by losers such as yourselves.

    Worst WTF evar.
  • George of the Jungle 2010-10-20 18:54
    Wait, let me get this right. He can write VB code by copy-and-paste, but hasn't graduated to a knowledge of loops? And he gets paid to do this by your company? Geez, I get a chance to teach this to 10 high school freshmen in a 5 day week. What should I tell them is the salary range for their advanced knowledge?
  • Spike 2010-10-20 18:56
    Normally i wouldn't even attempt to justify an abomination such as this, but the code does have one advantage:

    it enforces that that the number of parameters is a multiple of 3 at compile time; a vararg implementation could do this check at runtime, but not compile time.

    That said its still a stupid shitty way of doing things. If the multiple of 3 requirement *MUST* be checked at complie time a better strategy would be to only have the first 3 param, version and call it multiple times. If the records *MUST* be inserted at once, one could make a helper class with a 3 param AddRec method which builds the array, and a CommitRec method that actually calls setRecData(String[]).

    Though with that said, those 3 requirements do seem arbitrary but its hard to tell without knowing the context.

    While still a huge WTF, its possible this is the only way the origonal coder could figure to satisfy those requirements be they real or imaginied.
  • Your Name * 2010-10-20 19:18
    You Jackwagon:
    frits:
    Clearly he should've used recursion.

    BTW, Where's the definition of setRecData(String[])?

    Clearly you don't understand recursion.


    function Recursion(){
    if(confirm('Do you understand recursion?')){//if yes
    msgBox('Good for you.');
    }
    else //if no
    {
    Recursion();
    }
    }

    =D

    Captcha - Minim = Latin for 30, the number of times you do something before you understand you've wasted your time.
  • jk 2010-10-20 19:23
    This guy puts the grunt in grunt work...
  • Michael Chandler 2010-10-20 19:40
    public void setRecData(String... args) throws Exception
    {
    setRecData(args);
    }

    Done.


  • Dittybop 2010-10-20 20:40
    jasmine2501:
    Mark:
    Steve:
    The real WTF is that he put the commas on the left... who does that???

    Agreed, that's really dumb. A comma marks the end of a clause so it should be after the clause it delimits, not before the next one on the next line. Very weird style, glad I don't work with this guy.


    You see it all the time in SQL - it allows you to delete a line or comment a line in a big column list, without causing a syntax error...

    select col1,
    col2,
    col3 --you can't comment out this line
    from table

    select col1
    ,col2
    ,col3 --now you can comment it without an error
    from table

    +1

    Yeah, I do this all the time for various languages that have similar syntax...which is more or less all of them.

    to OP: If you want your commas to look like English, I hear there is still demand for COBOL programmers.

    db
  • John Hardin 2010-10-20 20:59
    Herby:
    Today's lesson: "There are three ways to code for sets: none, one, and many".

    ITYM "none, one and too many".
  • hoodaticus 2010-10-20 21:39
    In VB, you'd write one version with a parameter array and be done with it...

    Oh nevermind, C# can do that trick too.
  • Dave 2010-10-20 22:36
    I love the fact that you asked him about 20 sets, and he then went and catered for 30. That's going the extra mile ><.
  • EmperorOfCanada 2010-10-21 01:11
    What about negative one sets?
  • Markp 2010-10-21 01:18
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines.

    Most Java developers hate arrays too and encourage you to stay away from them for all but a certain, limited set of scenarios. But the "problems" you documented are easy to configure around.

    I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project

    Turn off Build Automatically; two mouse clicks.

    and pop up windows to tell you that the code you already know is incomplete will not compile.

    I've never in my lifetime seen Eclipse pop up a window for compiler errors. I think I have seen popups for when you try to run with code that doesn't compile, but that's a different issue.

    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users.

    I've never had any trouble sharing projects. You obviously have to remove any absolute referencing but past that you can check in the .project and .classpath files just like any other files.


    Eclipse is everything that is wrong with Java, and its name even implies its darkness.

    I don't mind people having strong negative opinions of an IDE. But it does bug me when they don't know what the hell they're talking about because they didn't spend 5 minutes trying to "fix" the things they perceived as "problems."

    Who the hell designed the interface? A transformer? Why do I need different views for browsing, editing, and debugging?

    You don't. Since I have a two-monitor environment my first action in a new workspace is to set up a two-monitor perspective that is optimized for everything I need to do on a day-to-day basis. On one monitor, real estate is precious so they provide a few different perspectives to optimize the screen for particular modes. Nothing's forcing you to keep them.

    No other applications work like that.
    Actually, many other applications work like that.

    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!


    If something's broken, log a bug. It's software, it's not perfect. That said I've never experienced this so my best guess is you have a plugin that's providing a conflicting hotkey for CTRL-C under certain modes. Check under Window->Preferences->General->Keys, sort by Bindings and see if there's any duplicates for CTRL-C.

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?

    Me. But in this case, I would suggest trying to work with it for a bit before dismissing your tool entirely. Almost everything you just mentioned is stuff that can be configured in about 3 minutes.
  • Markp 2010-10-21 01:23
    cod3_complete:
    Another thing that sucks about Eclipse is you can't open two projects (workspaces) at once without jumping thru hoops.


    You can open two projects at once without a problem. You can't open two workspaces at once. They are different concepts in Eclipse. And it bugs me too that the same binary can't be used to open to workspaces at once. Eclipse uses working sets for this issue though (define a working set over all the "projects" of your first "project", and interact with that). Unfortunately working set usefulness is pretty limited.
  • The 2-Belo 2010-10-21 01:50
    Herby:
    Alex:
    The REAL WTF is that the methods don't go up to 40. 40 rec data's is an absolute minimum for me.

    This is not as bad as it seems. In biblical times, the number '40' was often used as a synonym for infinite (like 40 days and 40 nights, etc.). Given that this is intended to accommodate ALL usage, it is a much better number.

    I suspect that the original coder had no concept of infinity when they coded the first example though.

    Today's lesson: "There are three ways to code for sets: none, one, and many".


    So I'm infinite years old. No wonder I'm tired.

    CAPTCHA: illum. Speaking Latin so much it makes you sick.
  • Concerned of Tunbridge Wells 2010-10-21 02:14
    why is he still allowed to code?
  • Candy 2010-10-21 02:46
    It does, ever since Java 5, but that's only six years old, so not everybody would have caught up with it.


    Try C99. IT's only 11 years old (just about to become 12) and most people don't really know it. Or C++98, 12 years old but people still can't understand it.

    We can't help that Java was WTF-inducing until 2004.
  • Chewbacca 2010-10-21 02:50
    I didn't read anywhere near all the comments, so I assume this has been pointed out before. I just couldn't help myself.

    Right, so The Tiobe Index proves that Java isn't TRWTF?

    How?

    More lines of Java have been written than any other language in 2010, yes, but that could mean that...
    1) Java is overly verbose
    2) Common code-style in Java wastes lines
    3) 2010 is the "Let's clean up our crap Java that we've ignored for 5 years" year.
    4) [insert random reason here]

    It says nothing about the quality, or even the popularity, just the number of lines.
  • Damien 2010-10-21 03:08
    Dittybop:
    jasmine2501:
    Mark:
    Steve:
    The real WTF is that he put the commas on the left... who does that???

    Agreed, that's really dumb. A comma marks the end of a clause so it should be after the clause it delimits, not before the next one on the next line. Very weird style, glad I don't work with this guy.


    You see it all the time in SQL - it allows you to delete a line or comment a line in a big column list, without causing a syntax error...

    select col1,
    col2,
    col3 --you can't comment out this line
    from table

    select col1
    ,col2
    ,col3 --now you can comment it without an error
    from table

    +1

    Yeah, I do this all the time for various languages that have similar syntax...which is more or less all of them.

    to OP: If you want your commas to look like English, I hear there is still demand for COBOL programmers.

    db


    Except, of course, that everyone who advocates this misses the fact that now, you cannot comment out the first line without introducing a syntax error - there's no avoiding the fact that there's going to be an issue at one end of the list or the other. (ditto for ANDed clauses, or anything else that has infix separators)
  • Chewbacca 2010-10-21 03:37
    Damien:

    Except, of course, that everyone who advocates this misses the fact that now, you cannot comment out the first line without introducing a syntax error - there's no avoiding the fact that there's going to be an issue at one end of the list or the other. (ditto for ANDed clauses, or anything else that has infix separators)



    SELECT
    foo,
    bar,
    bah
    FROM
    table
    WHERE TRUE AND
    foo > 1 AND
    bar IS NOT NULL AND
    bah < 1024 AND
    -- plop > 3
    ;


    Yep. Every single "solution" to these "problems" have the same flaw: It'll mess up in either one end or the other.

    That's why I like languages that allow

    my $foo = {
    foo => 'one',
    bar => 'two',
    boz => 'three', # Comma here is fine!
    };


    <3 Perl <3
    CAPTCHA: eros, how appropriate!
  • szeryf 2010-10-21 03:54
    The REAL WTF is that he does not use his own makeStringArray() method to create those arrays.
  • Captain Oblivious 2010-10-21 04:44
    Damien:


    Except, of course, that everyone who advocates this misses the fact that now, you cannot comment out the first line without introducing a syntax error - there's no avoiding the fact that there's going to be an issue at one end of the list or the other. (ditto for ANDed clauses, or anything else that has infix separators)


    You already can't comment out the first line without introducing a syntax error. Also, it is easier to actually perform the edits to remove a comma that is plainly visible than to find one that is missing, especially if they are staggered at the end of lines instead of put into a tabular form.
  • Severity One 2010-10-21 05:01
    EvanED:
    You look at it that way, but I look at "throws Exceptions" as basically just saying "I'm making this language that demands checked exceptions into a language that doesn't, but which requires a little extra syntax on the function definitions."

    Now you can argue about how much you have to fight against the language before it becomes a WTF, but I personally don't think that particular offense is anywhere near that level.

    Well, no. Checked and unchecked exceptions is just the way Java works. If you don't agree with unchecked exceptions, don't use Java.

    Given that the chief perpetrator of this article writes utility classes and methods (although the utility of them is on par with that of a chocolate teapot), throwing java.lang.Exception means that the user of those methods has no way of distinguishing between exceptions, least of all unchecked (run-time) exceptions.

    A tool like PMD will mark this in your source code.

    At work, I've introduced the explicit rule that catching java.lang.Exception is forbidden in all circumstances, and that catching java.lang.RuntimeException or any of its descendants is only allowed to prevent an ugly error message being shown to a user.

    If you catch all checked exceptions, there is no reason to catch java.lang.Exception.

    And because a run-time exception means that you have a bug in your code, catching it is only permitted at the very top level, and still a complete log has to be sent to the support section.
  • Rob 2010-10-21 05:12
    you must mean 42 right?
  • Vlaflip 2010-10-21 05:14
    Wow... A programmer that gets a request one day and has the code finished the next. Granted, the whole principle of his code is utter crap, but at least he's fast.
  • Design Pattern 2010-10-21 05:22
    Damien:

    Except, of course, that everyone who advocates this misses the fact that now, you cannot comment out the first line without introducing a syntax error - there's no avoiding the fact that there's going to be an issue at one end of the list or the other. (ditto for ANDed clauses, or anything else that has infix separators)

    To anyone of you commenting of what you see in SQL:
    THIS! IS! JAVA!

    And in Java, the following compiles without errors:

    String[] stringArray = {
    "a",
    "b",
    "c",
    };
  • Grumpy 2010-10-21 05:47
    Xenon Xavior:
    The best would be if setRecData with 23 arguments went and did something just slightly different from the rest. It could really weed out the men from the boys 5 years down the road when this piece of code was causing errors.

    You are *so* evil. I love you. Will you marry me?
  • Level 2 2010-10-21 06:42
    Chewbacca:
    I didn't read anywhere near all the comments, so I assume this has been pointed out before. I just couldn't help myself.

    Right, so The Tiobe Index proves that Java isn't TRWTF?

    How?

    More lines of Java have been written than any other language in 2010, yes, but that could mean that...
    1) Java is overly verbose
    2) Common code-style in Java wastes lines
    3) 2010 is the "Let's clean up our crap Java that we've ignored for 5 years" year.
    4) [insert random reason here]

    It says nothing about the quality, or even the popularity, just the number of lines.

    From your link: "Observe that the TIOBE index is not about the best programming language or the language in which most lines of code have been written."
  • Nico 2010-10-21 07:09
    public void wtf(String... params) {

    }

    public void wtf(String... params, String... params) {

    }

    public void wtf(String... params, String... params, String... params) {

    }

    :--D
  • Norris 2010-10-21 07:41
    Can you add me a fourth column? ;)
  • anonymous coward 2010-10-21 07:52
    cripes, someone give that guy a link to an explanation about varargs...
  • Design Pattern 2010-10-21 08:45
    Spike:
    Normally i wouldn't even attempt to justify an abomination such as this, but the code does have one advantage:

    it enforces that that the number of parameters is a multiple of 3 at compile time; a vararg implementation could do this check at runtime, but not compile time.

    Anyone bold / bored enough to write his/her own annotation for checking this at compile time?

    Such like:

    @NumberOfArgumentsMustBeMultipleOf("three")
    public void setRecData(String ... params) {

    PS:
    Why does the [s]strikethrough[/s]-tag not work in this forum?
  • Brendan 2010-10-21 08:57
    Hi,

    Chewbacca:
    Yep. Every single "solution" to these "problems" have the same flaw: It'll mess up in either one end or the other.



    SELECT
    foo
    ,
    bar
    ,
    bah
    FROM
    table
    WHERE TRUE
    AND
    foo > 1
    AND
    bar IS NOT NULL
    AND
    bah < 1024
    AND
    -- plop > 3
    ;


    Now you can comment either end...

    -Brendan
  • boog 2010-10-21 09:24
    Where's my damn article?
  • Bobby tables 2010-10-21 09:51
    TRWTF is Sourcesafe.

    Die Sourcesafe. Die.
  • boog 2010-10-21 10:30
    boog (unregistered):
    Where's my damn article?

    Calm down, evil twin. It's on its way.
  • Matt Westwood 2010-10-21 10:32
    boog:
    boog (unregistered):
    Where's my damn article?

    Calm down, evil twin. It's on its way.

    I'm sure that drunk Remy is taking his time sprinkling the article clues to indicate his homosexuality.
  • Cbuttius 2010-10-21 10:42
    Easy enough to write a code generator to create all that, so you wouldn't have to type it manually.

    Is it any practical use though?
  • FuBar 2010-10-21 10:45
    Vlaflip:
    Wow... A programmer that gets a request one day and has the code finished the next. Granted, the whole principle of his code is utter crap, but at least he's fast.
    Remember the old engineering adage, "You can't have it fast, and cheap, and right. At best you can have 2 out of 3." He chose "fast", and clearly it's not "right", so I hope he's "cheap" at least. It's a shame to waste all 3 of the 3.
  • uuang 2010-10-21 10:49
    Bobby tables:
    This is silly. Clearly the sort of thing should be done with a fruit loop.


    !
  • RogerWilco 2010-10-21 10:51
    Oh, and to the question of if people know a Python IDE. I used Eric3 a lot and never really had any trouble with it.
  • Severity One 2010-10-21 10:58
    Design Pattern:
    Spike:
    Normally i wouldn't even attempt to justify an abomination such as this, but the code does have one advantage:

    it enforces that that the number of parameters is a multiple of 3 at compile time; a vararg implementation could do this check at runtime, but not compile time.

    Anyone bold / bored enough to write his/her own annotation for checking this at compile time?

    Such like:

    @NumberOfArgumentsMustBeMultipleOf("three")
    public void setRecData(String ... params) {

    Um... you can use integer values in annotations, you know. (And strings, and any primitive type, and Class, and enums, and arrays of these.)
  • boog 2010-10-21 11:13
    boog:
    boog (unregistered):
    Where's my damn article?

    Calm down, evil twin. It's on its way.

    orly?
  • Chubber 2010-10-21 11:31
    I am sending you a bill for breaking the scroll wheel on my mouse.
  • Larry 2010-10-21 11:42
    TRWTF is source-code based programming languages.
  • Design Pattern 2010-10-21 11:46
    Severity One:
    Design Pattern:

    Such like:

    @NumberOfArgumentsMustBeMultipleOf("three")
    public void setRecData(String ... params) {

    Um... you can use integer values in annotations, you know. (And strings, and any primitive type, and Class, and enums, and arrays of these.)

    WHOOOOSH!

    Have a look at the name of the site this forum belongs to!

    Code posted here must be appropriate!
    (As a replacement in cases the daily article is missing!)

    CAPTCHA: jumentum

    Ju meant ... um, what?
  • TRUE, FALSE, ARTICLE_NOT_FOUND 2010-10-21 11:49
    It's official, there are no more WTFs in software.
  • Darth Remy 2010-10-21 11:50
    I have passed out...pray I don't drink anymore.
  • Zephod 2010-10-21 11:51
    Evidently, the one true number of record data's is 42.
  • frits 2010-10-21 12:20
    Did somebody mention it should be 42 instead of 40?

    How about varargs?
  • Bert Glanstron 2010-10-21 12:22
    frits:
    Did somebody mention it should be 42 instead of 40?

    How about varargs?

    You are an idiot and should be banned from your mummy and daddy's modem.
  • frits 2010-10-21 12:24
    Bert Glanstron:
    frits:
    Did somebody mention it should be 42 instead of 40?

    How about varargs?

    You are an idiot and should be banned from your mummy and daddy's modem.


    Do you ever leave?
  • Mark 2010-10-21 12:24
    Is it because 7 ate 9?
  • Mr Tired 2010-10-21 12:25
    I have seen actual code like that in database stored procedures and packages.
  • Old Meme Club 2010-10-21 12:30
    I can't see what's wrong with this code!
    You, Jared are the bitch who made the spec!

    CAPTCHA: eros
    Yep, i got it! But still miss the article of today.
  • Mara 2010-10-21 15:53
    So this is why Microsoft added the params keyword to C#.
  • sino 2010-10-21 17:53
    Spike:
    Normally i wouldn't even attempt to justify an abomination such as this, but the code does have one advantage:

    it enforces that that the number of parameters is a multiple of 3 at compile time; a vararg implementation could do this check at runtime, but not compile time.

    That said its still a stupid shitty way of doing things. If the multiple of 3 requirement *MUST* be checked at complie time a better strategy would be to only have the first 3 param, version and call it multiple times. If the records *MUST* be inserted at once, one could make a helper class with a 3 param AddRec method which builds the array, and a CommitRec method that actually calls setRecData(String[]).

    Though with that said, those 3 requirements do seem arbitrary but its hard to tell without knowing the context.

    While still a huge WTF, its possible this is the only way the origonal coder could figure to satisfy those requirements be they real or imaginied.
    Holy fuck, no. Make a Struct or Class with appropriate fields, and a parameterized constructor if your concern is compile time safety. Then, learn about loops. And get on with your life.

    IT IS NEVER ACCEPTABLE TO PULL THIS KIND OF IDIOTIC STUNT.

    ...well, maybe sometimes, in the heat of the moment, it's forgivable...
  • noname 2010-10-21 21:57
    Severity One:

    If you catch all checked exceptions, there is no reason to catch java.lang.Exception.


    Wrong.

    http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#13.4.21

    I believe there are also some depreciated methods in Thread that can lead to unexpected checked exceptions.
  • Severity One 2010-10-22 03:02
    Ah, well, but there are some other rules, such as 'do not use deprecated methods' and 'do a clean and build of your project before deploying'.

    Which should catch most of the cases. In all other cases, we employ corporal punishment on the developer responsible, so (s)he won't do it again.
  • Dan 2010-10-22 08:27
    Who lives under a bridge? Why it's you
  • Raphael 2010-10-23 16:29
    That's why people think programming is hard. They try to tackle programming with brute force(ctrl-c,ctrl-v) instead of smarts.
  • Luiz Felipe 2010-10-23 19:18
    spawn more overloads.

    amet. is some kind of amulet?
  • ipsi 2010-10-25 07:11
    cod3_complete:
    Moo:
    boog:
    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. *rant*


    Well, it's good to know that PHP isn't the only thing that Eclipse totally sucks at...


    Another thing that sucks about Eclipse is you can't open two projects (workspaces) at once without jumping thru hoops. I routinely open multiple projects in Visual Studio to add new changes to various projects through out the day. But when I had multiple projects setup thru Eclipse it just gave me an error message if I tried to open an additional "workspace". I guess those IBM guys really aren't that smart.


    Um, what? Sure, you can't open one workspace multiple times, but I frequently have 2 - 3 instances of Eclipse open, each pointing to a different workspace. But then, I use Linux too.

    Also, regarding the point about not being able to share projects: You can. I think it's retarded, but you can. It requires that everyone has the exact same Eclipse setup, though, and that people are very careful about experimenting with new Eclipse plugins (as they can change the .project file, and that makes things wonky for other developers if they don't have the plugin). I generally figure that IDE-specific files shouldn't be in Source Control. The only things that should be are what is required to build the project from the command line. That way each developer can configure their IDE exactly how *they* want, not how everyone else has it configured.

    And I honestly wouldn't care what IDE a developer used, so long as the end result was as expected (e.g. Unit Tests, no WTFs, compiles, etc).

    CAPTCHA: augue (augue, augue... round and round we go!)
  • Severity One 2010-10-25 08:14
    Now Netbeans has quite a few WTFs of its own (re-introducing bugs that had been fixed in a previous release comes to mind), but when I read about such silly restrictions in Eclipse, I think we made the right choice at work.

    Right now, I've got five projects open; my colleagues often have a multiple of that.
  • Pete 2010-10-25 14:23
    Holy sh*t, dudes!
  • Billy 2010-10-25 18:46
    @Deprecated:
    boog:
    Anon:
    Bob:
    Max Peck:
    Like was said earlier, a for loop. Does Java have a params type for passing multiple arguments in the formal parameter list? This one is nuts!


    I think the intention is to prevent callers from having to do this (prior to Java 5):

    setRecData(new String[] { "a", "b", "c" });

    Instead, they can do this (for up to 30 trios of string arguments):

    setRecData("a", "b", "c");

    In Java 5, of course, all this becomes unnecessary. Perhaps some newbie looked at this code and wondered, "WTF?!" It is all perfectly logical, even if it is overkill.


    Not sure that's much of a saving. Basically you have an extra "new String[] { " and an extra "}" to type in the first case, an extra burden that become completely insignificant as the number of arguments increases (it's a lot of extra guff for 1 argument, it's next to nothing for 30).
    Plus, you lose the ability of the caller to create the array in...I don't know....maybe a for loop instead of manually typing out 30 arguments. Or in other words, doing on the caller side what the function should be doing on the callee side.

    Yeah, but TRWTF is Eclipse, which for some reason has become the IDE of choice for the Java community. Eclipse hates arrays and makes every effort to keep you from using them by exibiting unpredictable and inconsistent indentation anytime you have to use them over multiple lines. I also enjoy how Eclipse encourages you not to save your work, because if you do, it will attempt to recompile your entire project and pop up windows to tell you that the code you already know is incomplete will not compile.

    One thing that totally amazes me is the way Eclipse has managed to prevent you from sharing your project between users. Before I encountered it, if you had told me that it was possible to not be able to share projects (which simply amounts to setting a source and class path), would would not have believed you. Eclipse is everything that is wrong with Java, and its name even implies its darkness.

    Who the hell designed the interface? A transformer? Why do I need different views for browsing, editing, and debugging? No other applications work like that.

    My favorite thing that has been happening lately is that copy occasionally decides not to work either with the keyboard or the popup menu. I can CUT and paste, but I cannot COPY and paste. How can you freaking screw up one of the fundamental operations of text editing? You have to restart to get it to work right!

    I'm mad as hell, but I guess I'm going to continue to take it because my company won't pony up the cash for anything better! Who was it that was in here talking about craftsmen and tools the other day?


    Uhhh... My eclipse has none of those problems. Where did you get yours?

    Okay I have one issue with eclipse: the preferences are stored per-workspace. So if I start a new workspace, then all my key mappings need to be reset, and I need to turn off the $%#@ spell checker *again*.

    The Real WTF is spell checking your source code!!!

    (The workaround is to create a blank default workspace, configure it, and copy that instead of using eclipse to create a new workspace).


    To continue on this Eclipse thread GAH! I downloaded eclipse IDE for PHP to try it out. I can't open some of the source code files, it comes with an "Unknown Error" WTF! The file opens fine using cyberduck (sftp) and textmate (mac editing program). Its quite sad, because I kinda like how eclipse works but practically its useless!
  • Gandor 2010-10-26 10:45
    I see that the original programmer really needs an idea to write code generating script for any given number of those sets.
    That would surely solve the problem. Can anyone imagine better way to waste i.g. 1GB for X generated overloads?
  • AC 2010-10-26 17:00
    WTF? Where is 40 used as a synonym for infinite in the bible? (IIRC it uses 'without number' or 'cannot be counted')
  • Arancaytar 2010-11-22 14:10
    Herby:
    Alex:
    The REAL WTF is that the methods don't go up to 40. 40 rec data's is an absolute minimum for me.

    This is not as bad as it seems. In biblical times, the number '40' was often used as a synonym for infinite (like 40 days and 40 nights, etc.). Given that this is intended to accommodate ALL usage, it is a much better number.

    I suspect that the original coder had no concept of infinity when they coded the first example though.

    Today's lesson: "There are three ways to code for sets: none, one, and many".


    There are rare cases where you can code for a specific number, but as a rule that number should be a known, constant and self-evident property of the data being stored - also, small.
  • Arasian 2010-12-30 12:07
    SmittyBoy:
    TRWTF is that the article author thought we couldn't guess what code was produced the next day, and decided to paste over 4000 lines of useless text.


    I knew what was coming, but that didn't stop me laughing harder the more I scrolled down.