• Candy (unregistered) in reply to Severity One
    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 (unregistered) in reply to frits

    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 (unregistered) in reply to Dittybop
    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 (unregistered) in reply to Damien
    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 (unregistered)

    The REAL WTF is that he does not use his own makeStringArray() method to create those arrays.

  • (cs) in reply to Damien
    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.

  • (cs) in reply to EvanED
    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 (unregistered) in reply to Alex

    you must mean 42 right?

  • Vlaflip (unregistered)

    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 (unregistered) in reply to Damien
    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 (unregistered) in reply to Xenon Xavior
    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 (unregistered) in reply to Chewbacca
    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 (unregistered)

    public void wtf(String... params) {

    }

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

    }

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

    }

    :--D

  • Norris (unregistered)

    Can you add me a fourth column? ;)

  • anonymous coward (unregistered)

    cripes, someone give that guy a link to an explanation about varargs...

  • Design Pattern (unregistered) in reply to Spike
    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 (unregistered) in reply to Chewbacca

    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 (unregistered)

    Where's my damn article?

  • Bobby tables (unregistered)

    TRWTF is Sourcesafe.

    Die Sourcesafe. Die.

  • (cs) in reply to boog
    boog (unregistered):
    Where's my damn article?
    Calm down, evil twin. It's on its way.
  • Matt Westwood (unregistered) in reply to boog
    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.
  • (cs)

    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 (unregistered) in reply to Vlaflip
    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 (unregistered) in reply to Bobby tables
    Bobby tables:
    This is silly. Clearly the sort of thing should be done with a fruit loop.

    !

  • (cs) in reply to FuBar

    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.

  • (cs) in reply to Design Pattern
    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 (unregistered) in reply to boog
    boog:
    boog (unregistered):
    Where's my damn article?
    Calm down, evil twin. It's on its way.
    orly?
  • Chubber (unregistered)

    I am sending you a bill for breaking the scroll wheel on my mouse.

  • Larry (unregistered)

    TRWTF is source-code based programming languages.

  • Design Pattern (unregistered) in reply to Severity One
    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 (unregistered)

    It's official, there are no more WTFs in software.

  • Darth Remy (unregistered)

    I have passed out...pray I don't drink anymore.

  • Zephod (unregistered) in reply to Herby

    Evidently, the one true number of record data's is 42.

  • (cs)

    Did somebody mention it should be 42 instead of 40?

    How about varargs?

  • Bert Glanstron (unregistered) in reply to frits
    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.
  • (cs) in reply to Bert Glanstron
    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 (unregistered)

    Is it because 7 ate 9?

  • Mr Tired (unregistered)

    I have seen actual code like that in database stored procedures and packages.

  • Old Meme Club (unregistered)

    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 (unregistered)

    So this is why Microsoft added the params keyword to C#.

  • sino (unregistered) in reply to Spike
    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 (unregistered) in reply to Severity One
    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.

  • (cs)

    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 (unregistered) in reply to DeGustibusNonDisputandumEst

    Who lives under a bridge? Why it's you

  • Raphael (unregistered)

    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 (unregistered)

    spawn more overloads.

    amet. is some kind of amulet?

  • ipsi (unregistered) in reply to cod3_complete
    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!)

  • (cs)

    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 (unregistered)

    Holy sh*t, dudes!

  • Billy (unregistered) in reply to @Deprecated
    @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!

Leave a comment on “Overloaded Help”

Log In or post as a guest

Replying to comment #:

« Return to Article