Just... I don't know anymore man.



  • This is Java code.

    Presented without further comment.



  • Who let the piss-poor C programmer use Java?



  • int oper

    Hey, it's three methods for the price of one!

    Also I wonder if those strings in the array are all single-character, with a NUL at the end.



  • @Jaime said:

    piss-poor C programmer

    That's my guess for who coded this piece of shit, too.

    Oh, and this is only a small part of a "Java" application that has about 5 different files, all over 1k LOC. This one in particular has over 8k, no packages declared, no concept of classes, total disregard for any kind of exception handling, a fucking mess. Inside each if you see there there are about 200 or 300 lines of code.

    It's infuriating. At least there's a project to replace it being negotiated with the client. This is what happens when non-tech companies leave their incompetent IT staff to their own devises for years and years.



  • One of the best tidbits of this application: It parses an XML file for input. Now, I can barely call this parsing: It iterates over every single XML element, and stores the tag on a string array, and the value of the element in another string array. The way to "find" a particular value is to search the tag array, fetch the index, and get the value from the value array using that same number.

    I have no fucking clue who the hell thought this was a good idea. Holy shit.



  • @dstopia said:

    I have no fucking clue who the hell thought this was a good idea.

    The only sane man that knew that you can't trust third-party XML parsers. And the XML specs limit the total number of tags to 999.



  • Fun fact: the Android SDK contains an XML 'parser' written in awk. It changes the record seperator to >, then much fun is had.



  • Somebody must've written that as some sort of joke.



  • @tar said:

    the Android SDK contains an XML 'parser' written in awk. It changes the record seperator to >, then much fun is had.

    Can you give a source, please?

    @marinus said:

    Somebody must've written that as some sort of joke.

    Or really serious. Maybe an ex-discodev that was sacked for being too sane?



  • @marinus said:

    Somebody must've written that as some sort of joke.

    If you depend on anything but coreutils that's too many dependencies.



  • @PWolff said:

    Can you give a source, please?

    How's this?


  • Winner of the 2016 Presidential Election

    @tar said:

    How's this?

    Surprisingly easy to understand, I'd say.



  • Agreed, however tr:wtf: is

    This file is not meant to be used directly, instead copy the
    functions it defines here into your own script then specialize
    it appropriately.



  • That's what code reuse means, right?



  • Copy-pasta coding also enables strongly typed API versioning. Just look at 90% of the Win32 API with *Ex functions. Ex all the things!



  • If you can get past the fact that it's an XML parser written in awk, then yeah, it's pretty well commented and so on...



  • @tar said:

    How's this?

    Accommodating my laziness.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.