- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
yawn..
Admin
Randy [snigger]
Admin
enjoyment = yawn * (++probeility_of_nap);
Admin
GES = “Global Customer Search”?
Admin
Admin
Post of The Day
Admin
A probeility is a probability factored by 100, it would seem.
Admin
I saw more interesting stuff when I was tutoring in college. This is just the kind of mistake people leave in when they are debugging, not really a WTF. I've done it before. You say to your self: "Okay so there's no real data in this thing, but I want to generate the search to see how the other function will react after it calls this function, but this function will return nothing right now because it needs data to run. I could make up test data or just have it make a number for right now so I can test the other thing" Simply human mistake, IMNHO.
Admin
Admin
let me see if I understand this correctly...
if a contact has a postal code and if they really, really have a last name ... otherwise if they have a last name ... otherwise they're Anonymous?
Admin
Otoh, the variable name probeility and the int minScore; minScore+=(float)3.8; can't be excused that easily.
Admin
I particularly like the variable scoring based upon how often getLastName() comes in and out of scope at any given (nano)moment.
Admin
Well I really enjoyed this one, its laden with WTFs.
the minor WTFs (perhaps even TRWTFs) being: return is float yet minScore is declared int and everywhere the values its given are cast as floats
the checking of srvRequest.getLastName() != null twice in one if(), then again in the else if()
the totally arbitary values assigned
Admin
This one is worth 3.8! That one's only worth 3.2!
No, they're both only worth 3. Nice try with the cast-to-float, though.
Admin
You probably did not see the "real WTFs" ;o)
What about
Admin
Oh gods, please why no don't. Now I must plummet from the roof of my building since it hurts so bad. You mean I can't have a job at some random guy/girls company because I have a different opinion on an article!? Oh the pain!
Admin
You had probably best not post anonymously when making such demands. It makes them almost impossible to comply with.
Admin
No, it's because you claim to have atrocious code standards and not think anything of it.
Admin
So now we know who teaches all these people to be WTF coders.
Admin
What language is this? It looks like java but it shouldn't even compile then...
Admin
Admin
I think it's C#, but what's the difference.
ducks for cover
Admin
So what happens in C# when you do
What is in i?
Admin
Admin
getLastName must be implemented like this:
So, duh, of course you need to check both the lastname and the next-to-last-name! It's in the spec!
Admin
I'm not exactly sure but doesn't an implicit downcast cause a C# compiler error?
Admin
Hey, I see what you did there.
This WTF may be boreing, but wow, that's a heck of a serious fail. I don't think there's a line of code that dooesn't make me want to punch babies.
It's bad enough when developers are sloppy and don't care, but that's nothing compared to this wonderful example of incompentence.
Admin
I'm more used to working with VB.Net, and VB doesn't have any problems eating this shit-for-code if you do not specify "option strict". Perhaps C# is equally 'flexible'. Perhaps it's only a warning (and I doubt these developers care about warnings...)
Admin
getLastName() - so good they Nulled it twice :-)
But I have no explanation at all for all those pointless (float) assignments to int minScore
I believe it was Niklaus Wirth who said, some 40 years ago, "There is not now and never will be any language in which it is the least bit difficult to write bad programs. Clearly this applies to C# as much as to any other.
Admin
.net's System.Convert can handle this (may round or truncate, not sure which) but c# certainly won't compile w/ an implicit cast like this.
Admin
Admin
I dont understand the line
if(srvRequest.getLastName() != null && srvRequest.getLastName() != null) ..
.. i would have wrote if(srvRequest.getLastName() != null && true) instead ;)
Admin
Wow, this is like the Zen of WTF.
I read it once and was, "wtf". I read it again and saw some more. I read it once more and saw even more. I read the comments and couldn't believe I had missed some.
I feel enjoyed. Thank you!
Admin
Obviously you don't have much experience in Side-Effect Based Programming.
Admin
The code snippet is Java, not C#.
Admin
That's what she said! rim shot
Admin
Admin
This doesn't make me think "WTF?"
This is the expected outcome when clueless dolts hire 'consultants' to weave magic from the latest development hype.
CAPTCHA - "appellatio" - like a hummer, only fruitier.
Admin
Yes.
Admin
Optimized:
Admin
assuming a sensible range of 0..100 of probeility
probeility < 50 -> 0 probeility < 100 -> 1 probeility = 100 -> 2
However, on embedded systems with low processing power it is standard to use approximative lookup tables for costy functions instead of applying the functions themselves.
Admin
Casting to a float and assigning to an int would cause a compile error in C#. The lastname&&lastname thing probably should have been firstname&&lastname, and the final minscore=2 may have been part of a deleted else but was left behind. This is what I'd call a 'midnight bug' - the result of writing code when you should be sleeping - at the very least, they're easy to fix.
Admin
It doesn't look like C# to me, for a start you can't assign a float to an int in C#, you'd have to cast the float to an int.
Would work but would be utterly horrible. You would be more likely to see:
Which would be more normal; in an equally horrible kind of way.
I also wouldn't expect to see get* methods in C#, you'd just use properties (which compile to methods, but still).
Not that it really makes any difference what language it's in, it's horrible code, not least because it loses precision with impunity.
Admin
Further optimized:
public float calculateWeight(int probeility)
{ return probeility / 50; }
Thank me later
Admin
Admin
Casting a float to an int just truncates in C#. 3.14 becomes 3, and so on.
But as people said you can't implicitly do it, so the code in the article won't compile. That being said I don't know what language it's in.
Admin
Hold on a second guys...
As soon as someone is so conceited that they feel that they can't just say something is their opinion, but that they have to say that its their not humble opinion, I always find it best to completely ignore them. And if they're a coder, chances are they're not a very good one. The best coders I've met have pretty much always been humble and modest.
So... bad code standards is just the tip of the iceberg is what I'm saying. :-)
Admin
Spelling error aside, it kinda looks like something went screwy with a change commit. Either someone committed something that they shouldn't have, or a merge got AFU.
Admin
On top of the WTF's in the implementation, I'm still trying to figure out exactly what this software is supposed to accomplish.
"Okay, if the two people have the same zip code and last name but different first names and birthdays, there's a 12% chance that they're the same person."
Admin