• testuser1 (unregistered)

    Symmetrical indentation!

  • Harrow (unregistered)

    What do the other calls look like?

  • duude (unregistered)

    That's a Java enum type, which is implemented as a class with predefined public static final instances. So, those are a bunch of oddly formatted constructor calls. Go be learned: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html

  • Little Bobby Tables (unregistered)

    Magic numbers! Magic numbers! Housey housey!

  • Wim (unregistered)

    The code itself doesn't seem too bad, though. It seems to be an enumeration of screen elements that are added to a screen. I see Unset, Hidden, Spacer, Empty, Radio_option, radio_buttons, drop_down_single and various other statements that seem related to screen elements. It's just that the formatting is weird. As if they made it this WTF shape on purpose! Well, the methods have too many parameters but that's a common issue and not always easy to avoid. The use of magic numbers instead of constants is also a bit annoying. But the code should just work fine and might even be generated by a code generator instead of a developer. It's just that someone decided to make the formatting real messy...

  • Supersonic (unregistered)

    These are Java constructor calls

  • jmc (unregistered)

    TRWTF is using eclipse

  • TheRealWTF(tm) (unregistered)

    This is truly inspiring. I think I'm going to write my next function in the shape of an erect penis…

  • Keith (unregistered)

    Another case of generated code passed off as hand-written?

    So TRWTF the way the pretty-printer formatted the code?

  • Andrew (unregistered)

    Looks like a developer passive-aggressively hating on the stupid interface they have to deal with...

    I think I'd talk to the developer and maybe see if there's some kind of technical debt work they could do to improve the interface.

  • RLB (unregistered)

    I suspect the specification was the worst part of this code, and the formatting is merely the programmer's way to protest the mess he was given to work with.

  • testuser1 (unregistered) in reply to TheRealWTF(tm)

    ASCII art strikes back!

  • Tim (unregistered)

    I especially like the "&emdash" - very meta

  • Little Bobby Tables (unregistered) in reply to TheRealWTF(tm)

    Call your project "New direction" or something.

  • Deez (unregistered)

    Proofread those emdashs

  • Developer Dude (google)

    Magic numbers need to be set somewhere (even if injected from somewhere, which is not always desirable in a UI, which this looks like it is settings for). Enums are a decent place to put configuration settings (which I assume they are) if they are very static and not likely to change.

    As others have said, the formatting is what is a bit weird and definitely hard to read, but I assume someone just got bored and decided to add that for fun.

  • Alan (unregistered)

    Given that it's pretty clearly specifying UI elements, it smells suspiciously like programmatically generated code.

  • Carl Witthoft (google) in reply to Little Bobby Tables

    <quote>Call your project "New direction" or something.</quote>

    Or "MIghtier than the sword" #whitespacematters

  • Carl Witthoft (google)
    Call your project "New direction" or something.
    or "Mightier than the sword" #whitespacematters
  • DM (unregistered)

    Some client told her to make the code pretty so the next commissioned coder could read it. The coder is being sarcastic, because she is a coder and that is the first language coders learn.

  • silent D (unregistered)

    The artist wants us to contemplate the HIDDEN nature of what is TRUE, what is FALSE, and what is FILE_NOT_FOUND.

  • James Hammond (unregistered)

    Ce n'est pas un entonnoir.

  • James Hammond (unregistered)

    Ce n'est pas un entonnoir.

  • W (unregistered)

    What magic happens after the DataType.STRING, in line 453? Drops of code?

  • Sole Purpose of Visit (unregistered) in reply to Wim

    The formatting is the least of your problems. (It isn't actually very readable formatting, but it's the least of your problems.)

    Let's first call out the DataType thing (I assume an enum). Now, it's a little unfair to assume that it will always be STRING or UNSET, because, you know, there are tens of thousands of lines of gibberish behind and in front of this, and maybe ... just once ... there is a need for FILE_NOT_FOUND. But probably not, because this is clearly intended for a Javascript front end, where strings is strings is strings. As, basically, is everything else. That's the way Javascript works (and I don't object to it).

    Now let's consider the issue of long parameter lists of booleans. This is abject. Gather them up into what C# would call a "flag enum" -- and I'm sure there's a congruent type in whatever language this is written in -- and express the desired behavior as, I dunno, "non-italic bold, no highlight, ignore font hints" or whatever.

    (Which, now I come to think of it, is the entire purpose of CSS.)

    This, basically, is a pathetic attempt at "fluent programming" which is only lacking one thing:

    The prefix "ef."

  • Sole Purpose of Visit (unregistered) in reply to Keith

    Probably not generated code. I mean, sure, it's stupid enough. But you'd need to explain (and I bled through both eyes whilst examining the sodding thing for this purpose) why the line break in the middle of a parameter list varies between one parameter, two parameters, six (I think) parameters on the first occurrence, where a parameter is actually some sort of function call with random internal line breaks, and so on.

    Also the rather lovely "funnel" effect to which Remy alludes. Code generation isn't generally bothered with this sort of thing. Cretinous programmers ... are. Does it work? Mebbe. Does it look pretty? It sure looks purdy.

  • (nodebb) in reply to Sole Purpose of Visit

    Flag enum: Thanks for that, I'll bear it in mind the next time it comes up someplace. That said, if you need lots of parameters and some of them are non-Boolean, then this is a great example of why:

    (a) the function definition/implementation should make them optional with sensible defaults (whenever that makes sense)

    (b) the code calling the function should identify its parameters by name, e.g. SomeFunction(RowOption: X, ColumnOption: Y) rather than just SomeFunction(X, Y)

    I've been bad about (b) myself in the past and it's slowly been coming back to bite me.

  • someone (unregistered)

    "most of which are false"

    Nitpicking here, but at a glance it looks like more are true.

  • (nodebb) in reply to Wim

    It's just that the formatting is weird.

    It's weird because they've not documented their enum, and the auto-formatter has got confused about where the ends of the enum members are (as the syntax is a little different from how much of the rest of Java works).

  • HK-47 (unregistered)

    Languages in which you can write this should be banned and the ban entorced with death penalty.

    What’ do you mean “you can write this in any language”?

    Nevermind, death penalty remark still stands!

  • dan (unregistered)

    That's not a funnel, it's a Martini glass. The artist is clearly making his own opinion on what needs done to work with that codebase clear.

  • John Adriaan (unregistered)

    This instantly reminded me of an entry in the International Obfuscated C Code Contest - only less functional: en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest#Examples

  • PenguinF (unregistered)

    What's the rating on the Enhanced Fujita scale?

  • Dave (unregistered)

    I can't believe none of you have actually spotted the cause of the formatting. Never seen the left hand side of that before in a long email thread? You can then turn it into the full thing by viewing it on a smaller screen in a gui that copies the indenting on line breaks.

  • Meh (unregistered)

    Don't see much wrong with this other than the formatting and poor naming choices.

    This is a Java enum, they are used for static config, and this very much seems to be doing just that.

  • WTFGuy (unregistered)

    I'm dying to learn about lines 454 & beyond. We can see the sample truncates the final Boolean / boolean parameter of the definition of the FREE_TEXT enum entry. So far, so predictable. But then what?? Are there another dozenish enum entries formatted as a growing upright pyramid forming a hourglass with the part we can see? Or is FREE_TEXT the last one, and we're merely missing "true)}" on the final line? How anti-climactic that would be. Or perhaps, (credit to W above) it continues in drips of code? Maybe a call to process_abort() or whatever is the moral equivalent for this environment?

    Enquiring minds want to know.

  • Аноня (unregistered) in reply to duude

    I don't have a lot of negative experience with Java, but is it really normal to have 96 boolean literals visible on a screenful of code at the same time? Only the formatting is unusual?

  • nasch (unregistered) in reply to emurphy

    "(a) the function definition/implementation should make them optional with sensible defaults (whenever that makes sense)

    (b) the code calling the function should identify its parameters by name, e.g. SomeFunction(RowOption: X, ColumnOption: Y) rather than just SomeFunction(X, Y)"

    In the language of this example (Java) neither of those is possible. YMMV.

Leave a comment on “Modern Art: The Funnel”

Log In or post as a guest

Replying to comment #:

« Return to Article