Comment On Some Call it Concatenation

Geoff Lane's predecessor, Brian, had a problem: none of the URLs their dataset started with "http://". This meant that, before displaying them in the UI, Brian would have to figure out a way to take the string "http://", and placed it front of every URL. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Some Call it Concatenation

2007-04-09 09:12 • by RON (unregistered)
What the...

Re: Some Call it Concatenation

2007-04-09 09:12 • by 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.

Re: Some Call it Concatenation

2007-04-09 09:13 • by DaveAronson
"ptth" so aptly describes this wtf.

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

-Dave

Re: Some Call it Concatenation

2007-04-09 09:13 • by strictnein
Brilliant!

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

Re: Some Call it Concatenation

2007-04-09 09:13 • by 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

Re: Some Call it Concatenation

2007-04-09 09:14 • by baron5038 (unregistered)
That's ingenious! Bravo!

Re: Some Call it Concatenation

2007-04-09 09:14 • by Bryan (unregistered)
Pure genius!

Re: Some Call it Concatenation

2007-04-09 09:19 • by Stupidumb
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.

Re: Some Call it Concatenation

2007-04-09 09:19 • by Shaun (unregistered)
Please tell me this is a grand cosmic joke?

Re: Some Call it Concatenation

2007-04-09 09:20 • by Skas (unregistered)
WOW...just wow

Re: Some Call it Concatenation

2007-04-09 09:24 • by 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?

Re: Some Call it Concatenation

2007-04-09 09:24 • by 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.

Re: Some Call it Concatenation

2007-04-09 09:27 • by Sean (unregistered)
??FTW

Re: Some Call it Concatenation

2007-04-09 09:30 • by Anonymous (unregistered)
I like how the google ads on the side are for such relevant items as 'Bass Strings' and 'String Cheese'.

Re: Some Call it Concatenation

2007-04-09 09:33 • by Nerdd
I really don't know what else to say than wow. Knowing about enumerators but not knowing string concatenation.. Spectacular.

Re: Some Call it Concatenation

2007-04-09 09:45 • by a guy from gr (unregistered)
What if somebody put a URL in the dataset with the ??\\:PTTH

Then they'd really be screwed.

Re: Some Call it Concatenation

2007-04-09 09:50 • by H|B
Stringy coders never cease to amaze me.

Re: Some Call it Concatenation

2007-04-09 09:50 • by Marc (unregistered)
omg

Re: Some Call it Concatenation

2007-04-09 09:50 • by KattMan
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.

Re: Some Call it Concatenation

2007-04-09 09:53 • by DaveAronson
130948 in reply to 130944
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)

Re: Some Call it Concatenation

2007-04-09 09:54 • by 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.

Re: Some Call it Concatenation

2007-04-09 09:55 • by Welbog
I can safely say that I am in awe.

Re: Some Call it Concatenation

2007-04-09 09:55 • by Stu (unregistered)
This is one of my favourites ones so far :)
The wrongness and creativity all jump out immediately, congratulations.

Re: Some Call it Concatenation

2007-04-09 10:10 • by Anita Tinkle (unregistered)
130952 in reply to 130928
WOW.

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

Re: Some Call it Concatenation

2007-04-09 10:15 • by mullzk (unregistered)
i shouldn't drink coffee when reading wtf. what a mess....

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

(fitting captcha: muhahaha)

Re: Some Call it Concatenation

2007-04-09 10:21 • by Zonkers
This use of PadLeft is pretty ingenious, assuming that this guy didn't know about concatenation. Truly ptth-y code.

Re: Some Call it Concatenation

2007-04-09 10:23 • by Exick (unregistered)
Good grief. What possible reason could someone have for doing that other than job security via obfuscation?

Re: Some Call it Concatenation

2007-04-09 10:25 • by shane (unregistered)
code as performance art.

nice.

Re: Some Call it Concatenation

2007-04-09 10:27 • by grumpy (unregistered)
130957 in reply to 130928
RON:
What the...

QFT

Re: Some Call it Concatenation

2007-04-09 10:29 • by Jonathan Pryor (unregistered)
130958 in reply to 130940
<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>

Re: Some Call it Concatenation

2007-04-09 10:30 • by boyd (unregistered)
And I thought the WTF was in the article spelling. :)

captcha : stinky

Re: Some Call it Concatenation

2007-04-09 10:52 • by topcat_arg
130960 in reply to 130959
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....

Re: Some Call it Concatenation

2007-04-09 10:57 • by Jeff S
130962 in reply to 130941
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?

Re: Some Call it Concatenation

2007-04-09 10:57 • by 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)

Re: Some Call it Concatenation

2007-04-09 10:59 • by TheD
130964 in reply to 130940
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.

Re: Some Call it Concatenation

2007-04-09 11:01 • by 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.

Re: Some Call it Concatenation

2007-04-09 11:02 • by Stephen Redd (unregistered)
130966 in reply to 130940
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#.

Re: Some Call it Concatenation

2007-04-09 11:14 • by snoofle
130967 in reply to 130928
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.

Re: Some Call it Concatenation

2007-04-09 11:30 • by - (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.

Re: Some Call it Concatenation

2007-04-09 11:34 • by Anonymous (unregistered)
130970 in reply to 130969
sure?

Re: Some Call it Concatenation

2007-04-09 12:01 • by 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

Re: Some Call it Concatenation

2007-04-09 12:06 • by 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...

Re: Some Call it Concatenation

2007-04-09 12:09 • by seejay
130975 in reply to 130969
-:
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

Re: Some Call it Concatenation

2007-04-09 12:10 • by scubasteve (unregistered)
duh, everyone knows the proper way to do this is a simple one-liner:

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

Re: Some Call it Concatenation

2007-04-09 12:10 • by 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.

Re: Some Call it Concatenation

2007-04-09 12:22 • by 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

Re: Some Call it Concatenation

2007-04-09 12:29 • by Phat Wednesday (unregistered)
130984 in reply to 130942
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

Re: Some Call it Concatenation

2007-04-09 12:41 • by UpNDown
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.

Re: Some Call it Concatenation

2007-04-09 12:56 • by brian (unregistered)
this is the most clever piece of code i've seen posted. It's horrible, but still clever.

Re: Some Call it Concatenation

2007-04-09 13:04 • by Prefect
130998 in reply to 130966
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.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment