• RON (unregistered)

    What the...

  • BBT (unregistered)

    A true WTF. The kind that makes you think "No way is this possible" because nobody could be capable of writing code without knowing string concatenation.

  • DaveAronson (cs)

    "ptth" so aptly describes this wtf.

    It pttheth me off. It'th the ptth. Pthththth! :-P

    -Dave

  • strictnein (cs)

    Brilliant!

    I do think, however, that this was more a fun little exercise for the original programmer than anything else.

  • Neal (unregistered)

    I knew it would be something like this when I saw the front page teaser, but I didn't suspect it would be this bad.

    Speaking of bad: Captcha - riaa

  • baron5038 (unregistered)

    That's ingenious! Bravo!

  • Bryan (unregistered)

    Pure genius!

  • Stupidumb (cs)

    I have never been so bored that I would do something like that.

    Hmmm, maybe the program ran too fast and he had to slow it down. It may be enough, but, instead of just reversing it, he should apply a couple of ROT13's, just to be sure.

  • Shaun (unregistered)

    Please tell me this is a grand cosmic joke?

  • Skas (unregistered)

    WOW...just wow

  • Aaron (unregistered)

    at least his solution didn't involve converting the things to the ASCII code, casting as an int, and then recasting back as a character.

    maybe he was getting paid by the line?

  • Volmarias (cs)

    This is no WTF at all, gentlemen! Much like saying "Richard Dawkins" three times in front of your mirror in the dark causes the Dark Lord of Atheism to appear, demanding a sandwich, using the despicable + operator to append one string to another invokes the horrible StringBuilder class! This lazy and ignorant class will naïvely add one string to another, with no thought at all of whether the two strings fit together! Why, with no consideration of breeding or standing, it is no wonder that programs that utilize this anarchist class end up horribly buggy and inefficient, unable to recognize their place next to their betters! This code snippet, on the other hand, wisely places one mere character next to the other, reserving space such that the two do not mingle. This snippet, gentlemen, preserves the purity of the urlString from the mongoloid and frankly simian apings of protocolString, keeping it pure and chaste.

    Gentlemen, when strings can co-mingle freely, our society will be ruined and our downfall terrible to behold, as bastard children will run about the streets, attempting to stick their periods and commas in anything they run across. And that, dear sirs, is not a world I wish to live in.

  • Sean (unregistered)

    ??FTW

  • Anonymous (unregistered)

    I like how the google ads on the side are for such relevant items as 'Bass Strings' and 'String Cheese'.

  • Nerdd (cs)

    I really don't know what else to say than wow. Knowing about enumerators but not knowing string concatenation.. Spectacular.

  • a guy from gr (unregistered)

    What if somebody put a URL in the dataset with the ??\:PTTH

    Then they'd really be screwed.

  • H|B (cs)

    Stringy coders never cease to amaze me.

  • Marc (unregistered)

    omg

  • KattMan (cs)

    There are computer scientists, then there are Code Artists. This guy is of the later. It would take years to appreciate the nuances of such a means of concatenation, delving into the poly-politcal meanings of each character, eventually learning of the heuristic meanderings of logic.

    If you chastise this code, you hate art and baby Jebus will kill a kitten.

  • DaveAronson (cs) in reply to a guy from gr
    a guy from gr:
    What if somebody put a URL in the dataset with the ??\\:PTTH

    Then they'd really be screwed.

    Sadly, I know of an organization that does prepend the http:// onto all submitted URLs... without checking if there is already one. You'd think that an organization that's all about communications, like Toastmasters International, would know better, but no....

    I teach a brief class on how to make and use a web site for your Toastmasters club. In it, I refer to TI HQ's site submission form as "Mensa software": smart, but sometimes too smart for its own good.

    -Dave (webmaster, Fairfax Toastmasters)

  • Ben (unregistered)

    This has got to be one of the best WTFs in weeks.

    Captch: doom. Not sure if it's refering to the game, or this guys career.

  • Welbog (cs)

    I can safely say that I am in awe.

  • Stu (unregistered)

    This is one of my favourites ones so far :) The wrongness and creativity all jump out immediately, congratulations.

  • Anita Tinkle (unregistered) in reply to RON

    WOW.

    This is a good WTF. I haven't seen something like this in a while.

  • mullzk (unregistered)

    i shouldn't drink coffee when reading wtf. what a mess....

    insanely great codeSOD, thanks. i mean... hell, no!

    (fitting captcha: muhahaha)

  • Zonkers (cs)

    This use of PadLeft is pretty ingenious, assuming that this guy didn't know about concatenation. Truly ptth-y code.

  • Exick (unregistered)

    Good grief. What possible reason could someone have for doing that other than job security via obfuscation?

  • shane (unregistered)

    code as performance art.

    nice.

  • grumpy (unregistered) in reply to RON
    RON:
    What the...
    QFT
  • Jonathan Pryor (unregistered) in reply to Volmarias

    <nitpick>

    This is C#, so StringBuilder won't be involved. Instead, String.Concat(s1, s2) will be used, which would permit a single char[] array allocation for the resulting string (since the size of s1 and s2 is known within String.Concat()).

    </nitpick>

  • boyd (unregistered)

    And I thought the WTF was in the article spelling. :)

    captcha : stinky

  • topcat_arg (cs) in reply to boyd

    well.. this guy never learned the first class of basic algorith, but he really understand how to pad left!!!

    there should exist a programmer license someday....

  • Jeff S (cs) in reply to Sean
    Sean:
    ??FTW

    great comment! made my morning ... thank you :)

    I have to believe that this guy was just bored out of his mind, maybe? Like he gets 1 simple, trivial programming assignment per week that takes minutes to do ... I had to fight that at my current job a bit. The previous programmers would take 2-3 months to implement an "are you sure?" prompt, so people here got used to things taking so long. So I would get a heads up to clear my plate for a "big project next week" and it would be something like that. Granted, I would still not code it backwards or anything like this since I could usually find plenty of other things to work on (and plenty of other WTF's to rewrite) .....

    anyway, that's the only logical explanation that i can think of ...

    Then again, why try to apply logic to a WTF?

  • Anonymous (unregistered)

    This one hurt, really HURT!

    To the one who messed this up: Stop coding or start reading ...

    captcha: muhahaha (I don't really feel like that right now)

  • TheD (cs) in reply to Volmarias
    Volmarias:
    This is no WTF at all, gentlemen! Much like saying "Richard Dawkins" three times in front of your mirror in the dark causes the Dark Lord of Atheism to appear, demanding a sandwich, using the despicable + operator to append one string to another invokes the horrible StringBuilder class! This lazy and ignorant class will naïvely add one string to another, with no thought at all of whether the two strings fit together! Why, with no consideration of breeding or standing, it is no wonder that programs that utilize this anarchist class end up horribly buggy and inefficient, unable to recognize their place next to their betters! This code snippet, on the other hand, wisely places one mere character next to the other, reserving space such that the two do not mingle. This snippet, gentlemen, preserves the purity of the urlString from the mongoloid and frankly simian apings of protocolString, keeping it pure and chaste.

    Gentlemen, when strings can co-mingle freely, our society will be ruined and our downfall terrible to behold, as bastard children will run about the streets, attempting to stick their periods and commas in anything they run across. And that, dear sirs, is not a world I wish to live in.

    That, lady and gentlemen, is pure commenting genius.

  • dolo54 (unregistered)

    This is too creative to be by accident. I'm convinced the author had to be laughing his ass off as he wrote this.

  • Stephen Redd (unregistered) in reply to Volmarias
    Volmarias:
    using the despicable + operator to append one string to another invokes the horrible StringBuilder class!

    er.... no, the + operator doesn't have anything to do with StringBuilder in C#.

  • snoofle (cs) in reply to RON

    Don't get me wrong - Alex's stories usually crack me up, but it seems that the shorter the story and code snippet, the more hilarious the wtf.

  • - (unregistered)

    This must have been made by someone who was just bored. The code does a lot of "advanced" stuff and if a programmer knows how to do that, (s)he also knows about string concatenation.

  • Anonymous (unregistered) in reply to -

    sure?

  • Marcos (unregistered)

    Is the most funny code that I never see.

    ... and I want to see the rest of the code, if you dont know how to concat, the rest must be sure better :P

    Cheers

  • Squall (unregistered)

    I wouldn't be surprised if this coder's efficiency was based on lines of code in a day. You have got to love upper management's love for metrics - which smart developers know there is always a short way and a long way to accomplish a certain thing.

    Captcha: Yummy, yummy metrics...

  • seejay (cs) in reply to -
    -:
    This must have been made by someone who was just bored. The code does a lot of "advanced" stuff and if a programmer knows how to do that, (s)he also knows about string concatenation.

    Or just had a massive brain fart. I've written complicated kludges of code or spent hours trying to get something to work, when there was a neat, short way around it but it just wasn't clicking. Last week I spent several hours trying to get a pop-up confirmation box to work (it wasn't just the box but a bunch of variables I was also trying to manage) until I went for a walk to clear my head and remembered I had already implemented a very quick and simple error catching / displaying system... and I could just use that instead of the stupid pop-up.

    But if someone brain farted and didn't think about string concatenation (something you learn in an introductory programming class back in highschool), then there's not a lot of hope for them as a coder. O_o

    Seejay

  • scubasteve (unregistered)

    duh, everyone knows the proper way to do this is a simple one-liner:

    return (urlString.reverse() + "//:ptth").reverse();

  • Kuerwen (unregistered)

    I cry foul...I think someone made this up. In fact I suspect a few of these WTFs lately have probably been made up by the commenters here.

  • Neal (unregistered)

    Anyone tried to do a Google code search on:

    PrependProtocol(string urlString)

    I get "Your search term - - could not be parsed: missing ) (PrependProtocol(string)"

    is this a Google wtf, I've never seen an unparsable search on Google?

    Captcha: bathe - yeah, I feel like I need a bath after this snippit

  • Phat Wednesday (unregistered) in reply to Anonymous
    Anonymous:
    I like how the google ads on the side are for such relevant items as 'Bass Strings' and 'String Cheese'.

    The real WTF is that this guy isn't using FireFox with adblock extensions

  • UpNDown (cs)

    Obviously done by someone who was given this task and told "You'll have to use concatenation to do this!" And he/she proved them wrong.

  • brian (unregistered)

    this is the most clever piece of code i've seen posted. It's horrible, but still clever.

  • Prefect (cs) in reply to Stephen Redd
    Stephen Redd:
    Volmarias:
    using the despicable + operator to append one string to another invokes the horrible StringBuilder class!

    er.... no, the + operator doesn't have anything to do with StringBuilder in C#.

    It does, but only if you are trying to concatenate about 4 or more strings in one statement that way.

Leave a comment on “Some Call it Concatenation”

Log In or post as a guest

Replying to comment #:

« Return to Article