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

    This is actually not a WTF. They are obviously using ProbeilitySpring, one of those frameworks that gives you tons and tons of implicit... well implicit everything. When evaluating what appears to be the same variable twice, the second evaluation actually runs against something entirely different. My guess is that they are checking something sensitive like SSN, and wanted to mask that in the code, you know as a security thing.

  • Steve H (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.

    Go on, enlighten us then, genius.

  • sane person (unregistered)

    Ah, you ignorant people. Clearly "probeility" is a technical term referring to a measure of the extent to which an object can be probed.

  • sane person (unregistered)

    Maybe srvReqeust does a database access. If they can successfully read the database twice in a row, this is clearly grounds for celebration and awarding a higher score. If that fails we see if it will at least work once.

  • 3rd Ferguson (unregistered) in reply to J

    And that's TRWTF because I know for a fact that in my ZIP code there is actually a 20% chance that someone who shares my last name is me.

    /CAPTCHA "nibh": Mrs. Frisby got lost

  • Matt (unregistered) in reply to Chuck

    Super-hyper-optimized:

    public float calculateWeight( MemberRequest srvRequest, int probeility)
    
    {
        return 0;
    }
    

    ..since I assume probeility is a value between 1 and 100, and dividing an int by an int results in (surprise!) a DIV. XD

  • ping floyd (unregistered) in reply to Guriga
    Guriga:
    assuming a sensible range of 0..100 of probeility

    From a mathematical point of view, shouldn't that be "a sensible range of 0 to 1?

  • Anon (unregistered)

    I finally got what it is supposed to do. If two entries match in all fields that are available, then this function is supposed to calculate the probability that they are the same person. That would be based on how many fields are available to match.

    Except of course they did not even get the function signature right, because you need to know both records that are being matched. If the seemingly matching record has a field that the record you are searching for does not, then that does not increase the probability of a match.

  • Not Important (unregistered)
    public float calculateWeight( MemberRequest srvRequest, int probeility)
    {
        int minScore = 0;
    
        if (srvRequest.getZipCode() != null)
        {
          if (srvRequest.getLastName() != null && srvRequest.getLastName() != null)
            minScore = (float) (minScore + 6.1);
          else if (srvRequest.getLastName() != null)
            minScore = (float) (minScore + 5.7);
          else
            minScore = (float) (minScore + 2);
        }
        else
          minScore = (float) (minScore + 2);
    
        // greatest possible value of 'minScore' at this point could be: 6
        if (srvRequest.getDateOfBirth() != null)
          minScore = (float) (minScore + 4.3);
    
        // greatest possible value of 'minScore' at this point could be: 10
        if (srvRequest.getID1() != null)
          minScore = (float) (minScore + 5.9);
    
        // greatest possible value of 'minScore' at this point could be: 15
        if (srvRequest.getID2() != null)
          minScore = (float) (minScore + 3.2);
    
        // greatest possible value of 'minScore' at this point could be: 18
        if (srvRequest.getPhoneNumber() != null)
          minScore = (float) (minScore + 3.8);
    
        // greatest possible value of 'minScore' at this point could be: 21
        if (srvRequest.getID3() != null)
          minScore = (float) (minScore + 5.5);
    
        // greatest possible value of 'minScore' at this point could be: 26
        if (srvRequest.getID4() != null)
          minScore = (float) (minScore + 5.9);
    
        // greatest possible value of 'minScore' at this point could be: 31
        minScore = 2;
    
        // greatest possible value of 'minScore' at this point would be: 2
    
        // returns integer division of 2 by unknown value of 'probeility'
        // which if less than 50 results in return value of 0
        return minScore * probeility / 100;
    }
    
  • Siegfried (unregistered) in reply to Kevin

    No, that´s why there is a thing like dependency injection.

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

    That's what she said! rim shot

    Your aim is off.

  • (cs)

    Is it GCS or GES? Maybe these are two separate projects, and they had to use the same weighing algorithm for both. When they were separated, the projects used something else for weighing, but when they were merged, the projects only needed getLastName() to be null, so instead of going in and changing the code, they just did a search and replace. Hence, the WTF with all the last namaes.

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

    Well played, sir.

    CAPTCHA: jugis - Al Bundy and I just sent in our subscription cards!

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

    pi is exactly 3!

  • Val (unregistered)

    Actually, this is a very genius and brillant security solution: this function is in such a position in the code, that on the company's specific architecture the instruction pointer will overflow exactly before reaching the ominous "minScore = 2;" part. So the processor will load the instruction from the specifically prepared part of memory (actually the top left pixel of the image of the company logo) which consists in a jump instrucion to exacty the position of the "return". So even if someone steals the code, no one else will ever be able to use this brillant part of carefully selected and scientifically tested probability calculation. And this feature will never be documented, just to make sure no one will be able to steal it.

  • Jimmy McJimbo (unregistered)

    This is amazing, the amount of WTF's is crazy. I would presume this is a methed in the MemberRequest class, so that you would run it as:

    MemberRequest thismr = new MemberRequest();
    MemberRequest othermr = new MemberRequest();
    int weight = thismr.calculateWeight( othermr, 24);
    

    Which leads me to my favourite WTF: the weight is based on weather the db entries of othermr exist or not, instead of if they match thismr. So whichever customer has the greatest amount of info, would always get the highest rating.

    2nd best WTF: is prolly that minScore is declared as int instead of float;

    3rd is: "minScore = (float) (minScore + 6.1);" which should be "minScore += 6.1F", or "minScore += (int)6.1F" considering minScore is an int.

    4th: "probeility", wtf is that?

    5th: "if (srvRequest.getLastName() != null && srvRequest.getLastName() != null)" "else if (srvRequest.getLastName() != null)" LOL, funny thing is, when refactoring code of mine once, i found "if ((bla == true) && (bla == true))" and thought to myself "what drugs was i on when i wrote this".

    6th: minScore = 2; I presume that was put in from testing with an empty db, and forgot about.

    7th: "return minScore * probeility / 100;" These are all ints, lol.

    8th: the arbitrary weight number each of the values get, I'd prolly give phone number a bit more weight, since ppl prolly wouldnt have the same ph number unless same household.

    9th: why does checking for last name rely on zipcode?

  • Anonymously Yours (unregistered)

    Huh. No wonder this is a WTF. It looks like it's missing some important comparisons.

    
    if (srvRequest.nothing() != null)
        minScore = null;
    
    if (srvRequest.fuckall() != null)
        minScore = (float) (minScore / 0); //Maybe I be needing this later...
    
    
    if (srvRequest.containsNotEqualBackwards() != null)
    {
        if (theStringToCompareFrom.equals(theStringToCompareTo))
            minScore = (float) 'croaton';
        else 
        {
            StringBuffer compareTo = new StringBuffer(theStringToCompareTo).reverse();
            StringBuffer compareFrom = new StringBuffer(theStringToCompareFrom).reverse();
            minScore = (float) (compareFrom.substring(0,11).trim().equals(compareTo.toString().trim()));
        }
    }
    

    CAPTCHA: commoveo -- I will pay in beero

  • Green Zebra (unregistered) in reply to David
    David:
    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."

    I disagree. It is quite easy to create a language in which it is absolutely impossible to write bad programs.

    Of course, such a language would make it impossible to write good programs, but that's not part of the spec.

  • Probeily Some Guy (unregistered) in reply to Chuck
    public float calculateWeight(MemberRequest srvRequest, int probeility)
    {
        return (float)probeility * 0.02F;
    }

    This version is probeily the best because multiplication is faster than division.

  • Anonymous (unregistered)

    So does anybody know what language this would actually compile in? It won't compile without throwing errors in java or C# apparently.

  • Mr.'; Drop Database -- (unregistered) in reply to Anonymous
    Anonymous:
    So does anybody know what language this would actually compile in? It won't compile without throwing errors in java or C# apparently.
    It follows Java naming conventions. What errors are you getting?
  • Anonymous (unregistered) in reply to Mr.'; Drop Database --

    Java should throw an error on the int = (float) cast unless there's some flag you can set to ignore that.

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

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

    I recently ran across some code I wrote that did exactly this double test for null. I have no idea how I managed to generate such stupidity, but fortunately the code still worked after I took out the second check. Or maybe it was the first...

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

    A lack of understanding on the basics of good software engineering practices does not constitute a valid opinion. Having an opinion does not necessarily makes it a valid one.

    For every single piece of atrocious code I've run into, there has been losses in the tens of thousands, if not hundreds of thousands of dollars associated to each of them.

    And for each of those code turds, there has been a a human code generator (calling him programmer denigrates the profession) who was of the opinion those turds were actually a-okay and not really a WTF.

    Leaving poorly written debugging code in live code is a WTF.

    Writing poorly written debugging code is also a WTF.

    Writing poorly written code is a WTF no matter what.

    And, barring language barriers, having misspelled words or variable names in poorly written code (not spelling errors on otherwise workable code, but on piss-poor, retardocalyptically badly written code) usually shows that the original developer either didn't give a rat's ass about quality (or the employer who was paying him his salary) or was completely clueless and overwhelmed and should be kept away from source code in the name of anything that is holy.

    Your opinion will take you places... probeibley. I'll give you one piece of gratuitous advice and take it for what it is:

    Instead of sarcastically going "excuse me for having a different opinion", spend some time in understanding what constitutes good principles of programming and why this particular piece of code is a true WTF.

  • (cs) in reply to ping floyd
    ping floyd:
    Guriga:
    assuming a sensible range of 0..100 of probeility

    From a mathematical point of view, shouldn't that be "a sensible range of 0 to 1?

    Probeily.

  • mypalmike (unregistered) in reply to Anonymous
    Anonymous:
    So does anybody know what language this would actually compile in? It won't compile without throwing errors in java or C# apparently.

    It compiles fine in C++ if you preface it with:

    #define public static
    
  • Rob (unregistered)

    I think I've gotten code from these consultants... love the three "lastname != null" clauses - all identical as far as I can tell.

  • Mr.'; Drop Database -- (unregistered) in reply to Anonymous
    Anonymous:
    Java should throw an error on the int = (float) cast unless there's some flag you can set to ignore that.
    Ah, you're right. I'd assumed it would only be a warning. It still looks an awful lot like Java, though, so maybe Alex introduced that error while anonymizing the code.
  • Machtyn (unregistered)

    The more CodeSODs I read on this site, the more convinced I am that I'd pass for a upper-level Jr developer. (i.e. I have a lot to learn, but sheesh, I can do a lot better than this tripe!)

  • Srv Lastname (unregistered)

    Hello, my company wrote this cod. It is protected by copywrite and we must demand that you do not share the special heuristic numbres with the Internet like this. We spend $1 MILLION EACH YEAR protecting our world leading reseach. Also you have put a typo in and it should be checking

    if (srvRequest.getLastName() != null && srvRequest.getFristName() != null)
    and after that fix it all work perfectly. You code snobs make me sick.

  • (cs)

    That's what you get for hiring people who have no special skills except for demanding exhorbitant hourly fees and avoiding steady work.

  • (cs) in reply to luis.espinal
    luis.espinal:
    Wolfan:
    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!

    A lack of understanding on the basics of good software engineering practices does not constitute a valid opinion. Having an opinion does not necessarily makes it a valid one.

    For every single piece of atrocious code I've run into, there has been losses in the tens of thousands, if not hundreds of thousands of dollars associated to each of them.

    And for each of those code turds, there has been a a human code generator (calling him programmer denigrates the profession) who was of the opinion those turds were actually a-okay and not really a WTF.

    Leaving poorly written debugging code in live code is a WTF.

    Writing poorly written debugging code is also a WTF.

    Writing poorly written code is a WTF no matter what.

    And, barring language barriers, having misspelled words or variable names in poorly written code (not spelling errors on otherwise workable code, but on piss-poor, retardocalyptically badly written code) usually shows that the original developer either didn't give a rat's ass about quality (or the employer who was paying him his salary) or was completely clueless and overwhelmed and should be kept away from source code in the name of anything that is holy.

    Your opinion will take you places... probeibley. I'll give you one piece of gratuitous advice and take it for what it is:

    Instead of sarcastically going "excuse me for having a different opinion", spend some time in understanding what constitutes good principles of programming and why this particular piece of code is a true WTF.

    The funny thing is the original post has nothing to do with this article. +1.0e127

  • JD (unregistered) in reply to eViLegion

    To be on the safe side he should never apply anywhere. 100% probability of success.

  • (cs) in reply to David
    David:
    getLastName() - so good they Nulled it twice :-)

    But I have no explanation at all for all those pointless (float) assignments to int minScore

    Well, the duplication is just "speedup reserve" - delete one to speed up your application if you need to. Delete everything but the last few lines for an even greater speed gain. (Yes, I doubt that's the real reason.)

    The (float) assignments weren't there initially - the junior developer had been introducing some floating-point weights and was wondering why they didn't show up in the final output, so he asked a coding guru for help who, in passing, gave it a glance and remarked "no wonder, the results of the multiplication get implicitly cast to int". The junior developer then looked up "cast" in the manual and made sure the result was properly cast to float instead. (Sounds plausible to me.)

  • exInhouse (unregistered)

    Hmm. This looks familiar. I think I was there. I was one of the in-hose developers. We were powerless to stop it. All we could do was watch in horror.

    The horror.

    THE HORROR!!

  • (cs) in reply to 3rd Ferguson
    3rd Ferguson:
    And that's TRWTF because I know for a fact that in my ZIP code there is actually a 20% chance that someone who shares my last name is me.

    ... and the other 80% are either wives, or sisters, or both?

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

    Or from primary school grammar lessons, apparently...

  • Me (unregistered) in reply to Sucky SQL Dufus

    Are we allt alking about an implicit cast while this is a school-example of an explicit cast?

  • Anonymous (unregistered) in reply to Me
    Me:
    Are we allt alking about an implicit cast while this is a school-example of an explicit cast?
    What we were talking about was this:
    int i = (float) 3.14
    This does not compile, but if it did it would be an example of an implicit cast because the float value (3.14) is being implicitly cast to an integer. You're getting confused because of the explicit cast of 3.14 to a float but that doesn't even need to be there and is in addition to the implicit cast of the float to the int. To simplify things a bit, the exact same code could be expressed as:
    int i = 3.14F
    This is functionally equivalent to the above code so it doesn't complie either, but it should make it perfectly clear that this is an example of an implicit cast from a float (3.14) to an int. Got it now?
  • Joe (unregistered)

    Looks like 5 dollar engineering to me?

    I thank God every day that people hire moronic consultants/contractors/software engineers that don't know how to write clean and efficient code because I know I will have a steady stream of contract work to fix these types of problems.

  • Patrick (unregistered) in reply to Green Zebra
    Green Zebra:
    David:
    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."

    I disagree. It is quite easy to create a language in which it is absolutely impossible to write bad programs.

    Of course, such a language would make it impossible to write good programs, but that's not part of the spec.

    It's called brainf*ck (http://www.muppetlabs.com/~breadbox/bf/)

  • Anonymous Coward (unregistered) in reply to Kevin

    I work with 'Randy' and a few notes:

    A. This code "works as designed." I questioned the lead contractor on the project and he confirmed that it's execution behavior is intentional. It is not an error.

    B. It compiles and runs (in production)

    C. The optimization: return 2 * probeility / 100; is pretty close but sorry, you broke the code. You missed that minScore is a member (and it is used later.)

  • Anonymous Coward (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    I work with 'Randy' and a few C. The optimization: return 2 * probeility / 100; is pretty close but sorry, you broke the code. You missed that minScore is a member (and it is used later.)

    My bad; the above is wrong for what was posted. There are actually two versions of this method in the same class with slightly different implementations. One sets a member and the other doesn't.

  • Anonymous Coward (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    My bad; the above is wrong for what was posted. There are actually two versions of this method in the same class with slightly different implementations. One sets a member and the other doesn't.

    To clarfiy: the code posted was modified from the original. minScore is a float declared as a member. It's not an int.

  • Evil Code Monkey (unregistered) in reply to exInhouse
    exInhouse:
    I was one of the in-hose developers.

    In-hose developer. Does the company use them to just blast out some code?

  • nasch (unregistered) in reply to Jimmy McJimbo
    Jimmy McJimbo:
    This is amazing, the amount of WTF's is crazy...

    2nd best WTF: is prolly that minScore is declared as int instead of float; ... 4th: "probeility", wtf is that?

    I think it's similar to "prolly".

  • (cs) in reply to Evil Code Monkey
    Evil Code Monkey:
    exInhouse:
    I was one of the in-hose developers.

    In-hose developer. Does the company use them to just blast out some code?

    They are the ones who get hosed with the maintenance of the crappy code after the consultants disappear with their big checks and leave shoddy documentation behind.

  • Evil Code Monkey (unregistered) in reply to frits
    frits:
    Evil Code Monkey:
    exInhouse:
    I was one of the in-hose developers.

    In-hose developer. Does the company use them to just blast out some code?

    They are the ones who get hosed with the maintenance of the crappy code after the consultants disappear with their big checks and leave shoddy documentation behind.

    Well, that would make me an in-hose developer then! I've been trying to clean out the crap left behind by my predecessors for 5 years now...and thanks to management's fear of change I've still got most of the system to go.

  • AC (unregistered)

    Heh, just found this gem on Metro PCS' website. This is the whole file!

    Contents of prefix.jsp:

    2	    
    3	    function getURLPrefix(){    
    4	        
    5	         return "/";    
    6	    }
    7	
    8	
    
  • For the rest of us (unregistered) in reply to Wolfan
    Wolfan:
    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!

    Yes, please do. It would save us from what ever monstrosity you might make.

    The coder doesn't even understand the difference between an int and a float. He even tries to cast a float into a float then passes it to an int!?

    int minScore = 0; ... minScore = (float) (minScore + 6.1);

Leave a comment on “Probeility of Success ”

Log In or post as a guest

Replying to comment #:

« Return to Article