• ilAn (unregistered)

    yawn..

  • JakeyC (unregistered)

    Randy [snigger]

  • a sponsor (unregistered)

    enjoyment = yawn * (++probeility_of_nap);

  • (cs)

    GES = “Global Customer Search”?

  • (cs) in reply to dkf
    dkf:
    GES = “Global Customer Search”?
    Probeily. Your GES is as good as mine...
  • (cs) in reply to steenbergh
    steenbergh:
    dkf:
    GES = “Global Customer Search”?
    Probeily. Your GES is as good as mine...

    Post of The Day

  • (cs)

    A probeility is a probability factored by 100, it would seem.

  • Wolfan (unregistered)

    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.

  • Anonymous (unregistered) in reply to Wolfan
    Wolfan:
    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.
    Don't ever bother applying for a job at my company.
  • Confused in Ct (unregistered)

    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?

  • Sprite_tm (unregistered)

    Otoh, the variable name probeility and the int minScore; minScore+=(float)3.8; can't be excused that easily.

  • David (unregistered)

    I particularly like the variable scoring based upon how often getLastName() comes in and out of scope at any given (nano)moment.

  • Matt (unregistered)

    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

  • ascii (unregistered)

    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.

  • methinks (unregistered) in reply to Wolfan
    Wolfan:
    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.

    You probably did not see the "real WTFs" ;o)

    What about

    if (srvRequest.getLastName() != null && srvRequest.getLastName() != null)
    ...
    else if (srvRequest.getLastName() != null)
    ...
    
  • Wolfan (unregistered) in reply to Anonymous
    Anonymous:
    Wolfan:
    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.
    Don't ever bother applying for a job at my company.

    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!

  • eViLegion (unregistered) in reply to Anonymous

    You had probably best not post anonymously when making such demands. It makes them almost impossible to comply with.

  • riddums (unregistered) in reply to Wolfan
    Wolfan:
    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!

    No, it's because you claim to have atrocious code standards and not think anything of it.

  • (cs) in reply to Wolfan
    Wolfan:
    I saw more interesting stuff when I was tutoring in college.

    So now we know who teaches all these people to be WTF coders.

  • Anonymous (unregistered)

    What language is this? It looks like java but it shouldn't even compile then...

  • Anonymous (unregistered) in reply to riddums
    riddums:
    Wolfan:
    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!

    No, it's because you claim to have atrocious code standards and not think anything of it.

    Exactly. It's a totally appalling attitude to have towards coding standards and I have a suspicion that most of the folks on this site would agree.

  • (cs) in reply to Anonymous
    Anonymous:
    What language is this? It looks like java but it shouldn't even compile then...

    I think it's C#, but what's the difference.

    ducks for cover

  • Anonymous (unregistered) in reply to steenbergh

    So what happens in C# when you do

    int i = (float) 3.14

    What is in i?

  • (cs) in reply to Anonymous
    Anonymous:
    So what happens in C# when you do
    int i = (float) 3.14

    What is in i?

    It's similar to pi, but after someone takes a "p".

  • (cs)

    getLastName must be implemented like this:

    class MemberRequest {
       public String getLastName() {
          return names_.removeLast();
       }
       private LinkedList<String> names_;
    }
    

    So, duh, of course you need to check both the lastname and the next-to-last-name! It's in the spec!

  • riddums (unregistered) in reply to Anonymous
    Anonymous:
    So what happens in C# when you do
    int i = (float) 3.14

    What is in i?

    I'm not exactly sure but doesn't an implicit downcast cause a C# compiler error?

  • justsomedude (unregistered) in reply to steenbergh
    steenbergh:
    dkf:
    GES = “Global Customer Search”?
    Probeily. Your GES is as good as mine...

    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.

  • (cs) in reply to riddums
    riddums:
    Anonymous:
    So what happens in C# when you do
    int i = (float) 3.14

    What is in i?

    I'm not exactly sure but doesn't an implicit downcast cause a C# compiler error?

    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...)

  • David (unregistered)

    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.

  • Sucky SQL Dufus (unregistered) in reply to Anonymous

    .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.

  • Kevin (unregistered) in reply to Wolfan
    Wolfan:
    This is just the kind of mistake people leave in when they are debugging...Simply human mistake, IMNHO.
    Yeah, that's why you put in a comment like "// Debug value" or something because you know you're only human and won't remember every little detail from you're mad debugging session.
  • Thomas (unregistered)

    I dont understand the line

    if(srvRequest.getLastName() != null && srvRequest.getLastName() != null) ..

    .. i would have wrote if(srvRequest.getLastName() != null && true) instead ;)

  • The Flaming Foobar (unregistered)

    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!

  • just me (unregistered) in reply to Thomas
    Thomas:
    I dont understand the line

    if(srvRequest.getLastName() != null && srvRequest.getLastName() != null) ..

    .. i would have wrote if(srvRequest.getLastName() != null && true) instead ;)

    Obviously you don't have much experience in Side-Effect Based Programming.

  • (cs)

    The code snippet is Java, not C#.

  • Gutter Mind (unregistered) in reply to The Flaming Foobar
    The Flaming Foobar:
    ... I feel enjoyed. Thank you!

    That's what she said! rim shot

  • Anonymous (unregistered) in reply to Anonymous
    Anonymous:
    So what happens in C# when you do
    int i = (float) 3.14

    What is in i?

    Nothing is in i, the code does not compile. If you want to cast between a float and an int it must be an explicit cast. So you'd need to do this:
    int i = (int)3.14F;
    In this snippet, your value of 3.14 is defined as a float by virtue of the postfix "F". It's then being explictily cast to an integer using (int). The result in variable i is 3.

  • Bubba (unregistered)

    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.

  • Someone too lazy to login and at work (unregistered) in reply to riddums
    riddums:
    Anonymous:
    So what happens in C# when you do
    int i = (float) 3.14

    What is in i?

    I'm not exactly sure but doesn't an implicit downcast cause a C# compiler error?

    Yes.

  • Anon (unregistered)

    Optimized:

    public float calculateWeight( MemberRequest srvRequest, int probeility)
    {
        return 2 * probeility / 100;
    }
    
  • Guriga (unregistered)

    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.

  • Patrick (unregistered)

    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.

  • Someone too lazy to login and at work (unregistered) in reply to steenbergh
    steenbergh:
    Anonymous:
    What language is this? It looks like java but it shouldn't even compile then...

    I think it's C#, but what's the difference.

    ducks for cover

    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.

    int i = (int)((float)4.12);
    

    Would work but would be utterly horrible. You would be more likely to see:

    int i = (int)4.12F;
    

    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.

  • Z (unregistered)

    Further optimized:

    public float calculateWeight(int probeility)

    { return probeility / 50; }

    Thank me later

  • Chuck (unregistered) in reply to Anon
    Anon:
    Optimized:
    public float calculateWeight( MemberRequest srvRequest, int probeility)
    {
        return probeility / 50;
    }
    
  • Sam (unregistered)

    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.

  • Foobarbaz (unregistered) in reply to Anonymous
    Anonymous:
    riddums:
    No, it's because you claim to have atrocious code standards and not think anything of it.
    Exactly. It's a totally appalling attitude to have towards coding standards and I have a suspicion that most of the folks on this site would agree.

    Hold on a second guys...

    Wolfan:
    IMNHO

    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. :-)

  • Your Name (unregistered)

    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.

  • J (unregistered)

    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."

  • (cs) in reply to fluffy777
    fluffy777:
    getLastName must be implemented like this:
    class MemberRequest {
       public String getLastName() {
          return names_.removeLast();
       }
       private LinkedList<String> names_;
    }
    

    So, duh, of course you need to check both the lastname and the next-to-last-name! It's in the spec!

    Soon people will run out of last names

Leave a comment on “Probeility of Success ”

Log In or post as a guest

Replying to comment #299110:

« Return to Article