• blahblah (unregistered)

    Poor Hashini

  • guest (unregistered)

    Goddamn Kendrick.

  • (cs)

    Now that's an interesting piece of code! And quite good, actually. Very informing comments, many useful functions;)

    Apart from being crazy, this guy must be a quite good programmer;)

  • (cs)

    That is not so much a WTF, but rather an OMG. And what's he got against Kendrick, anyway?

  • DeaDPooL (unregistered)

    Too far fetched to believe IMO

  • (cs) in reply to @Deprecated
    And what's he got against Kendrick, anyway?
    Not sure, perhaps
    Kendrick.do(Lauren);
  • (cs)

    Okay, that comparison algorithm is not nearly generic enough. It needs to allow for the user to weight the various attributes in a scaled fashion- it's simply too naive. I mean, think about it- a "1" face is likely a show-stopper, no question. But a "5" face should, theoretically, be average. It shouldn't affect the ordering of the Girl struct, because even if another girl has a "4" face, but a "6" body, they should be close in order.

    So, a non-WTF algorithm for quantifying people based on superficial physical characteristics would have the following features:

    1. Attribute weighting: based on preference, attributes are weighted (some people will do anything for a pretty face, others for a massive rack, etc.)
    2. Flexible attribute definitions: this algorithm offers nothing for the "ass man", nor does it offer fine grained control over "body", which- it's worth noting- contains many possible areas of interest.
    3. Sorting should be done based on distance from the mean, not on raw scores. This difference should be multiplied by the weight of that attribute, and that number should be summed up to provide the final "score".

    That sort of lazy code writing is TRWTF.

  • Kendrick (unregistered)

    WTF? Why does this guy hate me so much?

  • Corey (unregistered)

    Unfortunately Dave's not accounting for t*#s, a$$ and body. If you don't remember to check your edge conditions you can end up with TRWTF the morning after. I can't help but think that better unit testing might spare him some embarrassment...

  • Brian (unregistered)

    Clearly, using the variable name "cum" was a bit of a faux pas. Otherwise, looks very well done and professional.

  • Motty (unregistered)

    if (girl.Name == "Darcy") return cum;

  • Hashini (unregistered)

    Why Dave? WHY?

  • tater tots (unregistered)

    Fixed?

    const bool wouldIDoHer = true;

  • Andy (unregistered)
    --- a/Dave.cpp	2010-09-13 15:56:29.000000000 +0200
    +++ b/Dave.cpp	2010-09-13 15:59:02.000000000 +0200
    @@ -42,15 +42,16 @@
         short face;
         short body;
         short legs;
    +    short boobs;
         bool wouldIDoHer;
     };
     
     int CompGirl(Girl g1, Girl g2)
     {
         double g1_score = Square(g1.face) 
    -      + Square(g1.body) + Square(g1.legs);
    +      + Square(g1.body) + Square(g1.legs) + NthPower(g1.boobs, 3);
         double g2_score = Square(g2.face) 
    -      + Square(g2.body) + Square(g2.legs);
    +      + Square(g2.body) + Square(g2.legs) + NthPower(g2.boobs, 3);
     
         if (g1_score == g2_score)
             return 0;
    @@ -68,18 +69,21 @@
         AllGirls[0].face = 4;
         AllGirls[0].body = 5;
         AllGirls[0].legs = 4;
    +    AllGirls[0].legs = 1; // FIXME: needs to be added by Dave
         AllGirls[0].wouldIDoHer = true;
     
         AllGirls[1].name = "Darcy";
         AllGirls[1].face = 6;
         AllGirls[1].body = 5;
         AllGirls[1].legs = 7;
    +    AllGirls[0].legs = 1; // FIXME: needs to be added by Dave
         AllGirls[1].wouldIDoHer = true;
     
         AllGirls[2].name = "Hashini";
         AllGirls[2].face = 1;
         AllGirls[2].body = 4;
         AllGirls[2].legs = 4;
    +    AllGirls[0].legs = 1; // FIXME: needs to be added by Dave
         AllGirls[2].wouldIDoHer = false;
     
         //add sorting routine later
    

    FTF Dave

  • highphilosopher (unregistered) in reply to Andy
    Andy:
    --- a/Dave.cpp	2010-09-13 15:56:29.000000000 +0200
    +++ b/Dave.cpp	2010-09-13 15:59:02.000000000 +0200
    @@ -42,15 +42,16 @@
         short face;
         short body;
         short legs;
    +    short boobs;
         bool wouldIDoHer;
     };
    

    int CompGirl(Girl g1, Girl g2) { double g1_score = Square(g1.face)

    •  + Square(g1.body) + Square(g1.legs);
      
    •  + Square(g1.body) + Square(g1.legs) + NthPower(g1.boobs, 3);
      
      double g2_score = Square(g2.face)
    •  + Square(g2.body) + Square(g2.legs);
      
    •  + Square(g2.body) + Square(g2.legs) + NthPower(g2.boobs, 3);
      

      if (g1_score == g2_score) return 0; @@ -68,18 +69,21 @@ AllGirls[0].face = 4; AllGirls[0].body = 5; AllGirls[0].legs = 4;

    • AllGirls[0].legs = 1; // FIXME: needs to be added by Dave AllGirls[0].wouldIDoHer = true;

      AllGirls[1].name = "Darcy"; AllGirls[1].face = 6; AllGirls[1].body = 5; AllGirls[1].legs = 7;

    • AllGirls[0].legs = 1; // FIXME: needs to be added by Dave AllGirls[1].wouldIDoHer = true;

      AllGirls[2].name = "Hashini"; AllGirls[2].face = 1; AllGirls[2].body = 4; AllGirls[2].legs = 4;

    • AllGirls[0].legs = 1; // FIXME: needs to be added by Dave AllGirls[2].wouldIDoHer = false;

      //add sorting routine later

    FTF Dave

    TRWTF is that you made a copy/paste error in a post. AllGirls[0].legs is set three times (you forgot to change your index).

    Captcha opto -- opto mus prime's first name.

  • (cs) in reply to tater tots
    tater tots:
    Fixed?

    const bool wouldIDoHer = true;

    You forgot: const bool didSheSlapMe = true;

  • Anonymous (unregistered) in reply to Remy Porter
    Remy Porter:
    Okay, that comparison algorithm is not nearly generic enough. It needs to allow for the user to weight the various attributes in a scaled fashion- it's simply too naive. I mean, think about it- a "1" face is likely a show-stopper, no question. But a "5" face should, theoretically, be average. It shouldn't affect the ordering of the Girl struct, because even if another girl has a "4" face, but a "6" body, they should be close in order.

    So, a non-WTF algorithm for quantifying people based on superficial physical characteristics would have the following features:

    1. Attribute weighting: based on preference, attributes are weighted (some people will do anything for a pretty face, others for a massive rack, etc.)
    2. Flexible attribute definitions: this algorithm offers nothing for the "ass man", nor does it offer fine grained control over "body", which- it's worth noting- contains many possible areas of interest.
    3. Sorting should be done based on distance from the mean, not on raw scores. This difference should be multiplied by the weight of that attribute, and that number should be summed up to provide the final "score".

    That sort of lazy code writing is TRWTF.

    You've thought about this way too much!

  • (cs) in reply to Anonymous

    I was tempted to write pseudocode.

  • Richard (unregistered)

    TRWTF is storing information about "short legs". Everybody knows that legs should be long! Now his weighting will be all backwards.

    What, it doesn't work that way? Computers don't make that kind of call when reading source code? Hrmph. Well, it should.

    Of course, if he hadn't told anyone, what're the odds that this would even have been noticed, since it wouldn't show up on a diff unless you nailed one of those two versions?

  • Candy (unregistered)
    • NthPower(g1.boobs, 3); You're not reusing Cube...
  • (cs)

    I think we found the one instance where Access would have been the better choice.

  • (cs) in reply to Andy
    Andy:
    ...
         double g1_score = Square(g1.face) 
    -      + Square(g1.body) + Square(g1.legs);
    +      + Square(g1.body) + Square(g1.legs) + Cube(g1.boobs);
         double g2_score = Square(g2.face) 
    -      + Square(g2.body) + Square(g2.legs);
    +      + Square(g2.body) + Square(g2.legs) + Cube(g2.boobs);
    
    ...

    FTFY (why not use library functions that are already there?)

  • (cs)

    I can also guess what kind of appointment Dave has at 5pm.

  • (cs) in reply to JamesQMurphy
    JamesQMurphy:
    I think we found the one instance where Access would have been the better choice.

    No, Darcy would have been the better choice.

  • Jellineck (unregistered) in reply to JamesQMurphy
    JamesQMurphy:
    I can also guess what kind of appointment Dave has at 5pm.

    You want to get the prostitute at the start of her shift.

  • Rob (unregistered)

    Clearly, this disproves the stereotype that computer programmers are rage-filled and socially awkward.

  • Edy (unregistered) in reply to Andy
    Andy:
    [code] --- a/Dave.cpp 2010-09-13 15:56:29.000000000 +0200 +++ b/Dave.cpp 2010-09-13 15:59:02.000000000 +0200 @@ -42,15 +42,16 @@ short face; short body; short legs; + short boobs; bool wouldIDoHer; };

    FTF Dave

    Short boobs better than long boobs.

  • Google is your friend (unregistered)

    Dear Dave,

    A better idea would be to do a quick Google search and find out that you can in fact delete a file from a Subversion repository (if you use the URL).

    And Noah, do you even knowah anything about Subversion?

    kthxbye

  • Anonymous (unregistered) in reply to DeaDPooL
    DeaDPooL:
    Too far fetched to believe IMO
    From personal experience I disagree. The devs at my company are absolutely useless when it comes to code syncs (we use Serena Dimensions with the Windows Explorer plugin for synching a local work area with the back-end). They are forever checking in files that have no place being in source control, just because said file was in their work area and they forgot to delete/ignore it before syncing. This happens about once a week, give or take.

    Now, plenty of our coders write stuff on their own time, either proper code or fun little algorithms like Dave's "girl-ranking" algorithm. I really don't think it is much of a stretch for a non-work file to end up in a synchronisable work area. If that happens and you don't pay attention whilst syncing, crap like this is inevitable. I've never come across a girl-ranking algorithm but I have certainly seen plenty of examples of inappropriate files being commited to source control due to a bad sync.

  • Anonymous (unregistered) in reply to Rob
    Rob:
    Clearly, this disproves the stereotype that computer programmers are rage-filled and socially awkward.
    Yep, turns out we're actually pitiful and socially awkward. Much better.
  • Neville Flynn (unregistered)

    Looks like Kendrick isn't the one who's gonna get blackmailed.

  • (cs) in reply to Richard
    Richard:
    Of course, if he hadn't told anyone, what're the odds that this would even have been noticed, since it wouldn't show up on a diff unless you nailed one of those two versions?
    Not to mention, if he had been in the least bit competent, he would have just asked Google, or IRC, or any number of other places online how to undo a commit in Subversion rather than going to somebody on his team and bringing attention to himself. I think it is possible, but it's not pretty, and requires direct access to the repository (which I'm guessing he wouldn't have had).

    Still, blindly adding files to source control is incompetent anyway... Probably a Windows n00b.

  • Anonymous (unregistered) in reply to Remy Porter
    Remy Porter:
    I was tempted to write pseudocode.
    Pseudocode? At this point I'm starting to think you may already have a working prototype...
  • mfc (unregistered)

    //Remeber the f*cking appointment at 5 PM today

    I hope the f*cking appointment is for an interview somewhere else.

    This code is just begging to be put up on every bulletin board in the office.

    CAPTCHA: iusto

  • (cs) in reply to pbirmingham
    pbirmingham:
    And what's he got against Kendrick, anyway?
    Not sure, perhaps
    Kendrick.do(Lauren);
    +1

    You had me laughing at my desk. I tried sniffing coke because of that Darn ice cubes...

  • (cs) in reply to Anonymous
    Anonymous:
    Pseudocode? At this point I'm starting to think you may already have a working prototype...

    It's not my fault that finding optima in a search space is an interesting problem.

  • (cs) in reply to JamesQMurphy
    JamesQMurphy:
    I can also guess what kind of appointment Dave has at 5pm.

    It says right in the comment: it's a f*cking appointment.

  • Anonymous (unregistered)

    I've found the WTF in Dave's girl-ranking algorithm. It makes all the calculations correctly but fails to handle the GirlWouldntTouchYouWithATenFootBargePoleException that gets thrown as soon as he attempts to interop with the girl.

  • Martin Booth (unregistered)

    Why square everything in the comparison function? Without negatives it makes no difference. With negatives someone with a -5 for their face would rate higher than a 4.. didn't dave get this code reviewed?

  • boog (unregistered)

    So, the other day I was making the case that code was not a window into the emotions, experiences, and ultimately the soul of the developer.

    After seeing today's example, I stand corrected. Well played, TheDailyWTF. Well played.

    animal crackers or Lorna Doones
    Lorna Doones. No question. Cookie always beats cracker.
  • davee123 (unregistered)

    Where's the function to choose between Lorna Doones and Animal Crackers?

    I figured the WTF would be that he's always choosing Doones because Lorna.wouldIDoHer = true, but is false for animal crackers.

    DaveE

  • (cs)

    Maybe the appointment is for his daily spell checker? "Remeber"? Where's the second M?

  • (cs) in reply to highphilosopher
    highphilosopher:
    Andy:
    --- a/Dave.cpp	2010-09-13 15:56:29.000000000 +0200
    +++ b/Dave.cpp	2010-09-13 15:59:02.000000000 +0200
    @@ -42,15 +42,16 @@
         short face;
         short body;
         short legs;
    +    short boobs;
         bool wouldIDoHer;
     };
    

    int CompGirl(Girl g1, Girl g2) { double g1_score = Square(g1.face)

    •  + Square(g1.body) + Square(g1.legs);
      
    •  + Square(g1.body) + Square(g1.legs) + NthPower(g1.boobs, 3);
      
      double g2_score = Square(g2.face)
    •  + Square(g2.body) + Square(g2.legs);
      
    •  + Square(g2.body) + Square(g2.legs) + NthPower(g2.boobs, 3);
      

      if (g1_score == g2_score) return 0; @@ -68,18 +69,21 @@ AllGirls[0].face = 4; AllGirls[0].body = 5; AllGirls[0].legs = 4;

    • AllGirls[0].legs = 1; // FIXME: needs to be added by Dave AllGirls[0].wouldIDoHer = true;

      AllGirls[1].name = "Darcy"; AllGirls[1].face = 6; AllGirls[1].body = 5; AllGirls[1].legs = 7;

    • AllGirls[0].legs = 1; // FIXME: needs to be added by Dave AllGirls[1].wouldIDoHer = true;

      AllGirls[2].name = "Hashini"; AllGirls[2].face = 1; AllGirls[2].body = 4; AllGirls[2].legs = 4;

    • AllGirls[0].legs = 1; // FIXME: needs to be added by Dave AllGirls[2].wouldIDoHer = false;

      //add sorting routine later

    FTF Dave

    TRWTF is that you made a copy/paste error in a post. AllGirls[0].legs is set three times (you forgot to change your index).

    Captcha opto -- opto mus prime's first name.

    However, AllGirls[n].boobs is never set at all, which was apparently the point of the whole edit...

  • Doug (unregistered) in reply to mfc
    mfc:
    //Remeber the f*cking appointment at 5 PM today

    I hope the f*cking appointment is for an interview somewhere else.

    This code is just begging to be put up on every bulletin board in the office.

    CAPTCHA: iusto

    I believe the f*cking appointment is in a hotel, discussing a "job" with either Lauren or Darcy. Hashini apparently didn't make the cut.

  • (cs) in reply to blahblah
    blahblah:
    Poor Hashini
    Don't you mean lucky Hashini?
  • Adam V (unregistered)

    //ONLY EDIT WHEN NOBODY ELSE IS IN THE OFFICE //ONLY EDIT WHEN NOBODY ELSE IS IN THE OFFICE

    Wonder if he'd been caught editing this during work hours in the past.

  • Rock Ramshaft (unregistered) in reply to Motty
    Motty:
    if (girl.Name == "Darcy") return cum;

    not sure about the return statement, every time I've implemented this I've used an out parameter..

    sorry.

  • Vladimir Poutines (unregistered) in reply to Martin Booth
    Martin Booth:
    Why square everything in the comparison function? Without negatives it makes no difference. With negatives someone with a -5 for their face would rate higher than a 4.. didn't dave get this code reviewed?

    He probably meant to do root-sum-squared but forgot the root.

  • Andy P (unregistered) in reply to Martin Booth
    Martin Booth:
    Why square everything in the comparison function? Without negatives it makes no difference. With negatives someone with a -5 for their face would rate higher than a 4.. didn't dave get this code reviewed?

    Consider (assume only boobs and face are scored):

    Girls[0].boobs = 2; Girls[0].face = 2;

    Girls[1].boobs = 3; Girls[1].face = 1;

    In this case, under a simple linear comparison, both girls would score equally. But with attributes squared, Girls[1] would make a better lay, as her cracking norks more than make up for her hideous visage.

  • boog (unregistered) in reply to xtremezone
    xtremezone:
    Not to mention, if he had been in the least bit competent, he would have just asked Google, or IRC, or any number of other places online how to undo a commit in Subversion rather than going to somebody on his team and bringing attention to himself. I think it is possible, but it's not pretty, and requires direct access to the repository (which I'm guessing he wouldn't have had).
    Actually, it's very easy to remove files from a Subversion repository's history.

    Coincidentally, it's even easier to completely demolish your repository while doing so.

Leave a comment on “Dave.cpp”

Log In or post as a guest

Replying to comment #:

« Return to Article