• tekiegreg (unregistered) in reply to DMJ
    DMJ:
    Proof that you can't fix stupidity
    The unit test/assertion is the best I've seen at containing the damage from stupidity though :-p
  • Keith JM (unregistered) in reply to Severity One

    I think that depends on whether you exit through the door or the windscreen. He DID mention horrific car crashes.

  • (cs)

    The eventual solution is genius! Beforehand the "Vince" tool would corrupt the data but it would not cause an error immediately, only after it was done and had gone back to sleep; upon the error exploding they would cycle that tool as they knew it was the last that touched the DB, but would not really know why it did that since it was too late, the relevant state was gone. With Dan's solution they finally found a way to have the "Vince" tool stop on a breakpoint exactly as the corruption occurs, allowing the root cause to be investigated. Genius!

    Though I wonder how he managed to check in the modification to the unrelated unit test without Vince noticing… (managers who follow commits are the worst; you need to deploy amazing feats of obfuscation to get something past them)

  • Richard (unregistered) in reply to n_slash_a
    n_slash_a:
    result == false;

    Some languages won't let you do that; for example, C# will give you a compiler error: "Only assignment, call, increment, decrement, and new object expressions can be used as a statement"

    I'd be inclined to use: result ^= false;

  • Someone (unregistered) in reply to Jon Kalb
    Jon Kalb:
    The WTF here is Dan's. "Equals" is a term of art that has been in used for centuries before the invention of modern computers. If Dan has need for a concept that is similar too, but not exactly "equals" he should use a term that reflects this. Perhaps "BusinessEquals." But creating a function called "equals" that isn't defined to do what "equals" implies is a WTF asking to be corrected.
    I had a college professor who, in one lecture, drew a long horizontal line on the chalkboard. Then he said something along the lines of:

    What is the length of this line to the nearest meter? You can probably just look at it and safely conclude the answer is "one".

    What is the length of this line to the nearest centimeter? To answer that, you'll need a measuring tape, but it's still pretty straightforward.

    What is the length of this line to the nearest micrometer? That's trickier; on that scale, the start and end of the line are gradual--you don't have zero chalk one micrometer and 100% chalk the next. Also, at that scale, the line isn't perfectly straight; are you measuring the distance from the start to the end, or the integral along its actual path?

    What is the length of this line to the nearest angstrom? The answer to that question isn't even a constant; you'd need to worry about fluctuations on the quantum scale...

    To say that two things are "equal" can actually mean very different things depending on context. Perhaps the symbol we write for equality should be more complex, so that while you're drawing it, you'll have time to think about what you actually mean by it.

  • Ben Jammin (unregistered) in reply to Antti Nagesh
    Antti Nagesh:
    @llandor - I think you have missed the point about who will see that error message. It's a unit test message, not an application error message.
    TRWTF is fruitless effort. The guy admitted to being a manager, and yet you still try to correct him.
  • (cs) in reply to Someone
    Someone:
    Jon Kalb:
    The WTF here is Dan's. "Equals" is a term of art that has been in used for centuries before the invention of modern computers. If Dan has need for a concept that is similar too, but not exactly "equals" he should use a term that reflects this. Perhaps "BusinessEquals." But creating a function called "equals" that isn't defined to do what "equals" implies is a WTF asking to be corrected.
    I had a college professor who, in one lecture, drew a long horizontal line on the chalkboard. Then he said something along the lines of:

    What is the length of this line to the nearest meter? You can probably just look at it and safely conclude the answer is "one".

    What is the length of this line to the nearest centimeter? To answer that, you'll need a measuring tape, but it's still pretty straightforward.

    What is the length of this line to the nearest micrometer? That's trickier; on that scale, the start and end of the line are gradual--you don't have zero chalk one micrometer and 100% chalk the next. Also, at that scale, the line isn't perfectly straight; are you measuring the distance from the start to the end, or the integral along its actual path?

    What is the length of this line to the nearest angstrom? The answer to that question isn't even a constant; you'd need to worry about fluctuations on the quantum scale...

    To say that two things are "equal" can actually mean very different things depending on context. Perhaps the symbol we write for equality should be more complex, so that while you're drawing it, you'll have time to think about what you actually mean by it.

    That's the point of having to implement your own "Equals" method. :)

  • (cs)

    Dan stood up, went to Vince, grabbed his neck and smacked his head on the desk with all his might.

    "Yeah, something is broken indeed" said Dan, as he walked back to his desk.

  • (cs)

    I'm surprised that this article didn't end the same way as a similar one from last month:

    http://thedailywtf.com/Articles/Healthy-Competition.aspx

  • Sigivald (unregistered) in reply to Jon Kalb
    Jon Kalb:
    The WTF here is Dan's. "Equals" is a term of art that has been in used for centuries before the invention of modern computers. If Dan has need for a concept that is similar too, but not exactly "equals" he should use a term that reflects this. Perhaps "BusinessEquals." But creating a function called "equals" that isn't defined to do what "equals" implies is a WTF asking to be corrected.

    Turns out equality and IDENTITY are not the same thing. For that matter, I'm not aware of any object oriented language where a user-defined object has any expectations for "equals" (apart from being-the-exact-same-instance) baked in.

    It's almost like "equals" for user-defined objects is by convention in modern programming EXACTLY what you want me to think it isn't: Something where the implementer picks what is relevant for the purposes the object is meant for, and tells the rest to screw off.

    ("All men are created equal", for instance, does not mean that all men look the same.

    Interestingly enough, two dashboards being "equal" does not mean - in some deep and inherent sense related to the term Equal - they have the same preview graphic.)

  • Aska stupid question (unregistered) in reply to No'am
    No'am:
    ubersoldat:
    Awwww... no HTML comments :(

    This is why I don't work where managers are allowed to touch the code, you hire senior devs, architects and pretty much any one who doesn't have an MBA.

    I am a developer; I also have an MBA. What does that make me?

    Undesirable for hire, I guess

  • Severity Zero (unregistered) in reply to Severity One
    Severity One:
    Andrew:
    When I was a kid, my dad was the only one who said the word "dashboard". It was always in reference to some acquaintance of his that had a horrific car crash. And it was always horrific, always the dashboard, and it happened about every month or two. So to me, it's the thing that you bang your head against when you leave a vehicle.

    Thanks to my dad, "dashboard" is a bad word.

    I mentioned this to him about a month ago, and he added that it is often the thing you hit on the way into the vehicle.

    I'm struggling to think how on earth you manage to hit the dashboard with your head when either entering or exiting the vehicle. Isn't the dashboard where are the little dials and blinkenlights are?
    Where did it say head? Maybe I suck at reading comprehension

  • (cs) in reply to Y_F
    Y_F:
    Dan stood up, went to Vince, grabbed his neck and smacked his head on the desk with all his might.

    "Yeah, something is broken indeed" said Dan, as he walked back to his desk.

    This seems to be a somewhat career-limiting (and potentially freedom-limiting) solution.

  • ColinX (unregistered) in reply to MarkJ
    MarkJ:
    Y_F:
    Dan stood up, went to Vince, grabbed his neck and smacked his head on the desk with all his might.

    "Yeah, something is broken indeed" said Dan, as he walked back to his desk.

    This seems to be a somewhat career-limiting (and potentially freedom-limiting) solution.
    Yup, but nonetheless, sometimes there IS a reason why people go postal

  • Meep (unregistered) in reply to Severity Zero
    Severity Zero:
    Severity One:
    Andrew:
    When I was a kid, my dad was the only one who said the word "dashboard". It was always in reference to some acquaintance of his that had a horrific car crash. And it was always horrific, always the dashboard, and it happened about every month or two. So to me, it's the thing that you bang your head against when you leave a vehicle.

    Thanks to my dad, "dashboard" is a bad word.

    I mentioned this to him about a month ago, and he added that it is often the thing you hit on the way into the vehicle.

    I'm struggling to think how on earth you manage to hit the dashboard with your head when either entering or exiting the vehicle. Isn't the dashboard where are the little dials and blinkenlights are?
    Where did it say head? Maybe I suck at reading comprehension

    I'm still stumped on what part of your body touches the dashboard when you get into the vehicle. Are you just incredibly clumsy or drunk and just kind of fall in? Are you jumping in Dukes of Hazzard style? Is it a tall truck such that you climb in ass-first? Maybe you often have a huge erection when entering the vehicle and smack the dash with your penis as you sit down?

    Inquiring minds want to know.

  • Norman Diamond (unregistered)

    My knees often hit dashboards when getting in or out of a car. Sometimes even when sitting still. </offtopic>

    There seems to be a failure of anonymization. The behaviour of the Vince in this article was performed by someone named Dan in real life. I wonder how many promotions he's received since then.

  • David Cameron (unregistered) in reply to No'am
    No'am:
    ubersoldat:
    Awwww... no HTML comments :(

    This is why I don't work where managers are allowed to touch the code, you hire senior devs, architects and pretty much any one who doesn't have an MBA.

    I am a developer; I also have an MBA. What does that make me?

    Confused.

  • Friedrice the Great (unregistered) in reply to Aska stupid question
    Aska stupid question:
    No'am:
    ubersoldat:
    Awwww... no HTML comments :(

    This is why I don't work where managers are allowed to touch the code, you hire senior devs, architects and pretty much any one who doesn't have an MBA.

    I am a developer; I also have an MBA. What does that make me?

    Undesirable for hire, I guess

    Clearly overqualified.

  • (cs)

    I would change the object type of this.previewImage to something like DashboardThumbImage previewImage;

    DashboardThumbImage would be a new class that does nothing except extend the old class... and override equals() with something that always returns true.

    Solving a wtf with a wtf. Like fighting fire with fire.

  • (cs) in reply to Meep
    Meep:
    I'm still stumped on what part of your body touches the dashboard when you get into the vehicle. Are you just incredibly clumsy or drunk and just kind of fall in?
    Given that the context is horrific car crashes, I'm assuming that it's a case of entering through the windscreen, having just left your own vehicle through the windscreen.
  • (cs)

    Sigh,

    I see 2 problems here.

    1. Manager who thinks he can program. (probably because of all those TV shows where they use IT to "solve" everything)

    2. Manager can't admit his mistakes and just goes one with making the same mistakes.

    I wish a time will come when people will realize that IT is NOT for everyone. But maybe I ask for to much.

  • Planar (unregistered) in reply to Jon Kalb
    Jon Kalb:
    The WTF here is Dan's. "Equals" is a term of art that has been in used for centuries before the invention of modern computers. If Dan has need for a concept that is similar too, but not exactly "equals" he should use a term that reflects this. Perhaps "BusinessEquals." But creating a function called "equals" that isn't defined to do what "equals" implies is a WTF asking to be corrected.

    I agree in principle, but:

    1. Go tell that to the IEEE 754 / 854 committees :-(
    2. If the "equals" function must be the real thing, it should be provided by the language, not something that you have to code, because it can very easily be done by the compiler, so don't ask the programmer to do it.

    As for Dan, on the second occurrence, I would have told Vince "You need to talk to the last person who touched the dashboard code, and it wasn't me."

  • MightyM (unregistered) in reply to Severity Zero
    Severity Zero:
    Severity One:
    Andrew:
    When I was a kid, my dad was the only one who said the word "dashboard". It was always in reference to some acquaintance of his that had a horrific car crash. And it was always horrific, always the dashboard, and it happened about every month or two. So to me, it's the thing that you bang your head against when you leave a vehicle.

    Thanks to my dad, "dashboard" is a bad word.

    I mentioned this to him about a month ago, and he added that it is often the thing you hit on the way into the vehicle.

    I'm struggling to think how on earth you manage to hit the dashboard with your head when either entering or exiting the vehicle. Isn't the dashboard where are the little dials and blinkenlights are?
    Where did it say head? Maybe I suck at reading comprehension

    The bolded part.

  • (cs) in reply to Soviut
    Soviut:
    Steve The Cynic:
    I'm somewhat concerned that two dashboards can be the same for business-logic purposes and despite that, they look different.

    Why not? Two people may need to view the same data, but want to have it arranged differently for their own needs.

    Then they are "John's dashboard showing ABC" and "Bill's dashboard showing CBA", aren't they? Doesn't that make them different?

    Your line of reasoning isn't necessarily wrong, by the way, but it implies that there must be other attributes of a dashboard object that are not part of the data examined by BusinessEquals (to give the function its proper name). They would be things like "the order in which fields / subwidgets are displayed", because such things have an inevitable influence on the appearance of the preview image.

    An alternative explanation is that even if the two dashboards are identical in all other respects (same data, same layout, same background colour), they might not have identical preview images, because the preview image comparison compares e.g. Win32 bitmap handles, and there isn't a filename->bitmap handle cache. Each time a preview is required, the code just loads it again. The consequence is that each one has a unique handle, even if it came from the same file as the other one.

    Or maybe the preview is stored in the DB as a blob, and loaded separately for each dashboard.

    Or maybe the preview is rendered into a bitmap when the dashboard is loaded, and therefore each dashboard has a unique image.

    All of these are lame wastes of in-memory storage, but have the bonus attribute of having simpler (less to test!) code, even the last one...

  • opto (unregistered)

    It's not good enough. A Remy Porter article without witty little html comments? No sparkly unicorns? No Easy Reader Version?

    I'm disappointed. Fix this immediately.

  • Butthead (unregistered) in reply to Yaos
    Yaos:
    Obviously not true, Vince did not whine and moan how important his changes were and that Dan would just need to figure out how to make it work with those changes.
    http://thedailywtf.com/Articles/The-GNDN-Protocol.aspx This suddenly makes so much sense!
  • Sean (unregistered) in reply to ParkinT

    And those who can manage, manage just fine.

  • (cs)

    In C++ you have operator overloading so for two different objects a and b you can say a == b;

    In Java and C# you have to use .equals() or whatever as a==b only if they are the same object or both null (C++ equivalent to &a==&b);

    In C++ you have smart pointers which are objects that wrap a pointer. To say that aptr == bptr would usually imply they are wrappers to the same pointer, i.e. aptr.get() == bptr.get() and not that they just point to equivalent objects.

    So you could say that A is equal to B but not as equal as it is to A.

  • Daniel Rose (unregistered) in reply to Cbuttius
    Cbuttius:
    In C++ you have operator overloading so for two different objects a and b you can say a == b;

    In Java and C# you have to use .equals() or whatever as a==b only if they are the same object or both null (C++ equivalent to &a==&b);

    In C# you also have operator overloading.

  • (cs)

    well in any case it looks like the correct "fix" is to make businessEquals work with the correct logic for dashboard previews or whatever rather than disable the test.

    If two different views of the same object are considered "business equal" than this is the correct logic for this partciular overload.

  • (cs) in reply to Jon Kalb

    I think Dan's version of Equals plays right into the term of art that has been used for centuries. Imaging a white cup of coffee, sitting on a kitchen counter. Later in the day the cup of coffee is still there. It is the same cup. One might say it equals the cup from earlier. Later that evening, someone turns the light off. It gets very dark in the kitchen. If you squint really hard you can see a cup of coffee on the counter. But it doesn't look very white. Is it some how magically a different cup now? Just because the light turned off and it looks different than it did earlier that morning?

  • Pista (unregistered) in reply to opto
    opto:
    It's not good enough. A Remy Porter article without witty little html comments? No sparkly unicorns? No Easy Reader Version?

    I'm disappointed. Fix this immediately.

    Your wish is Mark's command - he added HTML comments :-)

  • unknown (unregistered) in reply to Severity One
    Severity One:
    Andrew:
    When I was a kid, my dad was the only one who said the word "dashboard". It was always in reference to some acquaintance of his that had a horrific car crash. And it was always horrific, always the dashboard, and it happened about every month or two. So to me, it's the thing that you bang your head against when you leave a vehicle.

    Thanks to my dad, "dashboard" is a bad word.

    I mentioned this to him about a month ago, and he added that it is often the thing you hit on the way into the vehicle.

    I'm struggling to think how on earth you manage to hit the dashboard with your head when either entering or exiting the vehicle. Isn't the dashboard where are the little dials and blinkenlights are?

    presumably you hit it when you exit the car through the windscreen.

  • ronpaii (unregistered) in reply to Planar

    I don't understand how a compiler can determine if 2 objects are equal. If I have a pound of apples and a pound of peas, are they equal? If you assume “do they weigh the same”, equal is true. By just about any other measurement equal is false.

  • (cs) in reply to Jochen
    Jochen:
    I wish a time will come when people will realize that IT is NOT for everyone.
    But then where would we go for entertainment?
  • Foo (unregistered) in reply to ColinX

    Isn't the right to go postal protected in the law of some states?

  • Butthead (unregistered)

    PHP does this right. You got == and ===.

    1 == TRUE -> True, as they both equal 1 1 === TRUE -> False, as TRUE is a different type

    1 == "1" -> True, as they both equal 1 1 === "1" -> False, as a string isn't an integer

    1 === 1 -> True, as both value and type are the same 1 === 5 -> False. Type is the same, but value isn't.

    Long live PHP!

  • (cs) in reply to Andrew
    Andrew:
    I mentioned this to him about a month ago, and he added that it is often the thing you hit on the way into the vehicle.
    I would have guessed the windshield, myself.
  • (cs) in reply to ronpaii
    ronpaii:
    I don't understand how a compiler can determine if 2 objects are equal. If I have a pound of apples and a pound of peas, are they equal? If you assume “do they weigh the same”, equal is true. By just about any other measurement equal is false.

    That's what typeof() is for.

  • Spewin Coffee (unregistered) in reply to Andrew
    Andrew:
    I mentioned this to him about a month ago, and he added that it is often the thing you hit on the way into the vehicle.

    I'm having difficulty visualizing this one. How many people come through his windshield daily? He might want to do something about that problem.

    Regardless, thanks for the laugh.

  • Ben Cooke (unregistered)

    I'm not sure it would've helped in this case, since "Vince" is clearly rather deranged, but I think Dan could also have done a better job with the initial comment: instead of just stating that it shouldn't be there, he should've stated why it shouldn't be there.

    I think a good rule of thumb is that any time you find yourself having to explain the reasoning for some code verbally you should put that reason in the comments, because you can be pretty sure that this won't be the last time that question is asked.

  • Spewin Coffee (unregistered)
    "STOP. STOP. What the hell is wrong with you, you frickin’ pantload. You have just made a terrible mistake. Again. Put down the mouse, remove your hands from the keyboard, and step away from the computer. Call x5316 before doing anything else."

    The passive-aggressive solution to the problem is to simply explain the situation to end-users and let them deal with Vince:

    "Dear unfortunate user, you are getting this error message because Vince (x5748) changed the system in a way that I, Dan (x5316), have repeatedly told him not to and he previously agreed to never touch again but chose to do so anyway. As a result, this system is broken until I fix it. Please verbally abuse Vince at your earliest convenience. - Sincerely, Dan"

  • Dude (unregistered) in reply to Jon Kalb

    Who said BusinessEquals? Perhaps that the image is a transient variable that should't be included in a such a test?

    Go read Java's definition of equals, you'll get a feeling of just how much this function can (should) be.

  • dave (unregistered) in reply to anon

    And then accuse Dan of not testing it, even though Vince added his changes after Dan tested the code.

  • Danno (unregistered) in reply to Chris

    SVN is a tool and shouldn't be required on your resume.

    No, the moral is not to work for an unethical boss whose only goal seems to be brow-beating his employees in order to feel good about himself.

  • AnonyMark (unregistered)

    This article made me laugh out loud. Just wow. I'm getting the strangest error messages...

  • (cs) in reply to ParkinT
    ParkinT:
    Managers should not participate in developers' job of writing code

    "Those who can, do and those who can't MANAGE those who can" Ironic, eh?

    It's also trite and not always true; there are plenty of managers who are perfectly capable of doing and are also perfectly capable of managing. It's also probably true that you should either do one or the other.

  • Moonraquel (unregistered) in reply to llandor
    llandor:
    Although the idea of making an obnoxious error message that confuses the user is intriguing..

    Back in his Cobol days (as opposed to his 'being dead' days), my father put in the error message "Stop being an idiot!" in a production system. It was triggered if the user gave the same type of erroneous input three times in a row (there was a prompt that very specifically stated what the correct format for input was). It didn't go over too well since the end users were all women so they got that error message basically all the time.

  • Your Name (unregistered)

    The left and right justification makes the article look like it was written by Shatner:

    Vince... had... also... “corrected”... the... unit... test...

  • nubyi (unregistered) in reply to Severity One
    Severity One:
    Andrew:
    When I was a kid, my dad was the only one who said the word "dashboard". It was always in reference to some acquaintance of his that had a horrific car crash. And it was always horrific, always the dashboard, and it happened about every month or two. So to me, it's the thing that you bang your head against when you leave a vehicle.

    Thanks to my dad, "dashboard" is a bad word.

    I mentioned this to him about a month ago, and he added that it is often the thing you hit on the way into the vehicle.

    I'm struggling to think how on earth you manage to hit the dashboard with your head when either entering or exiting the vehicle. Isn't the dashboard where are the little dials and blinkenlights are?

    not into the vehicle. innnto the vehicle... behind the dashboard, where no human head should ordinarily be located...

Leave a comment on “Equals”

Log In or post as a guest

Replying to comment #:

« Return to Article