- 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
Admin
I think that depends on whether you exit through the door or the windscreen. He DID mention horrific car crashes.
Admin
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)
Admin
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;
Admin
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.
Admin
Admin
That's the point of having to implement your own "Equals" method. :)
Admin
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.
Admin
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
Admin
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.)
Admin
Admin
Admin
Admin
Admin
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.
Admin
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.
Admin
Confused.
Admin
Clearly overqualified.
Admin
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.
Admin
Admin
Sigh,
I see 2 problems here.
Manager who thinks he can program. (probably because of all those TV shows where they use IT to "solve" everything)
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.
Admin
I agree in principle, but:
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."
Admin
The bolded part.
Admin
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...
Admin
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.
Admin
Admin
And those who can manage, manage just fine.
Admin
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.
Admin
In C# you also have operator overloading.
Admin
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.
Admin
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?
Admin
Your wish is Mark's command - he added HTML comments :-)
Admin
presumably you hit it when you exit the car through the windscreen.
Admin
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.
Admin
Admin
Isn't the right to go postal protected in the law of some states?
Admin
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!
Admin
Admin
That's what typeof() is for.
Admin
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.
Admin
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.
Admin
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"
Admin
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.
Admin
And then accuse Dan of not testing it, even though Vince added his changes after Dan tested the code.
Admin
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.
Admin
This article made me laugh out loud. Just wow. I'm getting the strangest error messages...
Admin
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.
Admin
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.
Admin
The left and right justification makes the article look like it was written by Shatner:
Vince... had... also... “corrected”... the... unit... test...
Admin
not into the vehicle. innnto the vehicle... behind the dashboard, where no human head should ordinarily be located...