- 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
Hi! I'm Dan.
How many of you have had an article published on this site?
This is my second. One thing I've discovered is that between what you send in and what appears, there's some pretty heavy fictionalization going on. Sometimes it makes the story funnier or more incisive; sometimes it emphasizes the point the story was supposed to make. Sometimes, though, it really screws things up.
In the original story, there was no Vince. There was just a team of developers diligently trying to follow the Boy Scout rule--leave the code better than you found it. I didn't use the VCS's blame command to find out who did it, but I wouldn't be surprised if it was a different person each time.
Oh--and in answer to one issue that came up: yes, it's important that the preview image didn't participate in business-equals. Every time you save a Dashboard, a thumbnail image is computed. If one of the little thingies on the Dashboard is displaying a different number or picture than it was displaying last time that Dashboard was saved--a virtual certainty--the image will be slightly different. It's the number, nature, and positions of the little thingies on the Dashboard that should determine business equality, and those things were already being checked with the existing Equals method.
Here's the original story I sent in.
We had a class in our project called Dashboard that--well, it doesn't matter what it did, other than that it displayed a bunch of stuff on the screen. It had a business-equals method so that we could compare two dashboards and see if they were the same.
We decided to add a data field to our Dashboard class to hold a preview image--sort of a thumbnail so that folks could look at a whole bunch of Dashboards in a list and get a rough idea what they'd look like on the screen without having to let them actually take over the screen.
Now, the preview image shouldn't participate in the business-equals method, because there are a whole lot of ways the preview images for a couple of Dashboards could be minutely different even if the Dashboards themselves were exactly the same. So when I added the preview image, I specifically didn't change the business-equals method.
But a guy who was reviewing my code got hold of me and said, "You forgot to add the preview-image field in the business-equals method." So I explained to him that it didn't belong there.
"Ah," he said, and added a comment to that effect in the existing business-equals method. "Don't add a check for previewImage equality here, it doesn't belong," and like that.
So a week later we were getting puzzling failures in the application--not the tests--and I traced them back to the business-equals method on Dashboard, where somebody had added--right under that comment--a comparison for previewImage. Just cleaning up the code, you see, trying to leave it better than he found it, noticed something missing and slapped it in. Didn't pay any attention to the comment, because (of course!) comments can generally be presumed to be obsolete and misleading.
So I took out the check and the comment, and instead added a new test that created two Dashboards that were alike in every way except that they had different preview images, and asserted that the two of them were business-equal. The test had a nice intention-revealing name, like previewImageShouldNotParticipateInBusinessEquals.
Everything was fine for a week, and then we began getting puzzling failures in the application--not the tests--again. I went to Dashboard and found the check for previewImage in the business-equals method again. I goggled, and went and found my special test. It was still there, but the assert-true had been changed to an assert-false to make it pass.
Argh!
So I fixed everything, and then in that test, further down, I added another--fairly obscure--assertion that the two Dashboards with the different preview images were equal, where it could only fail if the assertion before it had been changed, and in that assertion I put one of those special explanatory strings that gets printed to standard output when an assertion fails: "You frickin' pantload, you didn't even frickin' read the frickin' name of this frickin' test, did you? Put down that frickin' mouse right now and call me immediately at 123-456-7890!"
It's been a couple of months, and I haven't gotten any calls, but we haven't gotten any more puzzling failures in the application but not the tests since then.
Admin
The problem with comments--at least in this case--is that they weren't read by any of the people who made the bad changes. That's my general reflex as well. As an ancient developer with many years of history behind me, I've been burned so many times by obsolete comments that I pretty much ignore them these days unless I have reason to know that they are extremely recent. And sometimes even then.
I'd much rather look at the code to find out what's going on, even if I have to navigate all over the place to find the code. Modern IDEs usually make that pretty simple.
Anyway, to somebody who doesn't read comments, it doesn't matter what's in those comments.
I think the transition from comment to automated unit test was an improvement, although in this case even that didn't dissuade somebody from doing what he thought was correcting an error: it took a honeypot followed by a deliberately offensive error message. I expect that message has been seen once or twice, and the change that prompted it then quietly Ctrl-Zed away.
So far that's worked, but it shouldn't be necessary, sez I.
Admin
Are we talking about thedailywtf.com here?
Admin
That's the place where no one reads the comments (before adding their own of course).
Admin
Dad probably drives a late model big-ass American four door sedan. These had real dashboards that protruded well into the cabin with a handy shelf with a big steel wire perfectly aligned with your face should you be wearing the lap belt and in an accident, or just braking hard.
Admin
I have to disagree with you here. "Equals" has been used for centuries, but the notion of equality is not unique, even in mathematics. Equality (as a predicate) is always computed relative to some equivalence relation, and there are typically many equivalence relations for any structure (there is one for every quotient on the structure).
And this is ignoring "philosophical" issues like Liebniz versus other notions of equality.
That said, the WTF is that two distinct notions of equality are in play on a single type. A new type should have been made to reify the distinct notions.
Admin
Some definitions of equal are more equal than others.
Admin
"Since insanity is doing the same thing and expecting different results[...]"
Hahaha, my favourite quote from a WTF and the only explanation why that guy did the same mistake again and again. Personally, I would quit the job with a bang, first asking that guy directly whether he was dropped on the head as a child and then beat him up.
Admin
Such as "I know Subversion."
Admin
Never heard of the sword. And if you use the mine, make sure the side that says "Front towards PHB" is pointed in the correct direction.
Admin
Did he GLV? lol He must have in order to get the hand slap assert error message... how can superiors be given the title if they're 9 times out of 10, NOT! You know what that's called? Laymen with a degree...
Admin
No, it's not, it's never been.
It's not because you've read it on the internet that it's true. It's now because Scott Adams said it several times that it's true.
People, stop using this catchphrase : it's wrong.
Insanity is not that. And that, isn't insanity.
You're intelligent people. If you think about it for a few seconds, you'll see that this assertion is false, in both directions.
People, stop using this catchphrase : it's wrong. Thank you.
Oh it feels good to finally say it !!
Admin
ijwtk why the dev didn't immediately take the evidence to his manager's manager & have the fukker fired, or @least kneecapped;-}