- 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
When I was reading the story, I was almost sure that the second table allowed for one notice per day, in a 30-day month. I was wrong.
Admin
Admin
The real problem, as well as TRWTF, was inadequate Nigel.
"We cut out the hard part and pass the savings on to ME!"
Admin
Let me get this straight. The database design immediately proves Nigel is a moron - and yet still Jon was "expecting some incredibly clever code to map user notices to the notices table and do all the filtering and sorting"? I'm not sure I'd have even dared to open the code, let alone expected it to be awesome.
Admin
Elaborate please. I fail to see how you could get 2^30 messages displayed simultaneously.
Admin
Wait, this can still work.
All you have to do is run a VM with a fresh database for each user. Then every time there is a new notice, look up which users on which VMs need their database updated. You'd have to keep a hash to store the usernames and vm ids, then you could call getUsersDatabaseMachineFromHash(string username). For power-users you could assign more than one VM to get around the 30 alert limit.
Admin
TRWTF is using a
inside a table.
No wait, TRWTF is using a table. (hmm, maybe not in this case. It's debatable.. ;)
Admin
Admin
That Nigel dude is obviously just incompetent, probably he's a web developer so he's mostly done the visual stuff. Groovy colors, rounded borders, javascript flyover stuff and the likes, and never touched a database before.
The real asshole (can I say that here?) is that Jon guy. At the very first sight of the database "design", he should've gone to the poor guy and explained to him that it's not right, and show him how to do it. Motivate him, get better results, and maybe even one a real, working thingamawhatsit. Sheesh. So now they have no web dev/designer, no working notification system, and the wanker (can I say that here?) Jon still employed - there's the real WTF.
Admin
Yes indeedy. And with Ruby on Rails that would be almost the complete application :-)
So why is it that database design WTFs always seem to be the worst WTFs? Is it a subject which is unusually badly taught? Or is it an area which is especially tricky for the self-taught?
Admin
Use the 30 int columns as individual bits in a large integer and in effect you have a 'new' foreign key which could map to the noticeid...
However if anyone tried that on code I had to maintain I would be tempted to do harmful things to him/her with a large solid cluebat! (My head hurts just thinking about the horrible stored procedures which would be used to do the mapping, especially since the columns appears to be nullable...)
Yazeran
Admin
In my opinion it is because in order to do a proper database design you need to have a somewhat solid grasp on math and mathematical logic to do it, not something the average self taught Joe developer has. He may have heard about normalization, but without some math skills he will not realize WHY normalization is good and do it horribly when he has to do it in practice.
Yazeran
Admin
Maybe it's because database design is sort of the foundation of a good (well .. working - nonWTF) application. The rest you can mostly fix later, but if you mess up with the fundamentals, you carry them and theis messy cosequences to the biter end
It's like building a skyscraper.... you screw up with the roof, someone else can put on a new roof .. if you screw with the foundation, you have to tear down the whole thing.
Reminds me of a cartoon: Some italian architect in the year ca. 1173: "Yeah, we cut some corners with the foundation, but I don't think anyone here in Pisa will notice"
Admin
The real WTF was using tinyints as booleans. What he should have done was use bigints as bitmaps. That way he would have been able to fit 8 bytes worth of boolean flags in one field.
Admin
Exactly what I thought when I read it
Admin
(Remember, it was 30 comments for the whole site, not for a single customer).
Admin
I think I know exactly what Jon was thinking:
[image]Admin
Jon should watch out for some very special css I suspect ...
Admin
Update: Apparently, Nigel was recently appointed Mayor of Simpleton
Admin
not quite. in html [not in xhtml] you are allowed to have non-closed tags. :P
Admin
A++++
Admin
Damn, beat me to it... ;oP
Admin
This.
We're all used to see code which has had requirements added and added to it until it's total spaghetti code. Unfortunately, this is almost common and we expect it.
But it's much much harder to fake an understanding of logic when you're creating a database. There difference between right and wrong is too obvious.
Admin
Looks like a C++ programmer in the making.
Admin
Yeah, then Nigel goes to the management with Jon's solution that he created for poor Nigel while neglecting his own projects. Result? Nigel gets promoted because he's an overachiever and Jon gets yelled at for not getting his stuff done.
Also, it would certainly be nice (in a humanity kind of way) to help Nigel and "motivate him" but the fact is that he was hired to do work he was clearly unable to do. He's incompetent and it's not up to Jon or anyone else to change that. It's up to Nigel himself.
Admin
Tables should represent things in the application domain, i.e. that the users might talk about or want to see lists of.
The test: how well would this design work if there was a million of everything?*
Nigel got two-thirds of point 1. He got tables for Notices and for The-List-of-Notices-Each-User-Should-See. Give him credit, probably there was already a Users table. He was smart enough not to have the List-of-Notices-Each-User-Should-See hold copies of each notice's text. I've seen that before.
He didn't apply the test, though. Applying it would (perhaps!) have prompted him to seek another design.
Oh, and if you're going to make a valid argument against point 1 for some corner case, you're well beyond the level of knowledge held by the "average ... Joe developer". Not that saying that will stop any invalid arguments...
Admin
This would remove the ability to show/hide for specific users so it doesn't quite work.
Admin
They once said that the entire auto market for North America was no more than a few hundred cars. With that kind of foresight, I can't see how a company would need more than 30 notices.
Admin
TRWTF is ASP.
Everything would have been so much better if it was coded in PHP.
Admin
signed
AND why did he use colspan=5 for an single cell? And the unclosed tag at least shows me, that he is a messy coder. For sure these are not the only problems with his code. For me a good coder is someone who makes code and database design, which any good coder is able to work further too. If you can't be teamable and blame others for not understanding code, which is not better but only complicated, you don't fit in any Company. Like the guy, some comments before, who was proud of the fact, that nobody could easily understand his comlicated made projects, which would probably work using "normal" Database Design as good as he did it. Maybe even faster because good database queries are faster then some loops with complicated string operations and you get out, and are able to directly work with exactly the data you need.
only my opinion
Admin
Depends, if Jon is working with Nigel on the project, then he should alert someone senior about what is going on - then it is up to them to take corrective action. By the sound of it Nigel doesn't bother thinking about a design, how it fits the requirement or any other thing. On the other hand, if Jon is not working on the project it comes down to seeing that Nigel isn't up to it, and offering to help. The problem with all of this is that people like Nigel will do all they can to pass the blame to whoever offered them advice. Jon will probably have picked up that Nigel is not a guy to be trusted, either with his word or his programming abilities, and will have made his own conclusions. Some people you just can't motivate - they won't listen, take or seek out advice, or even do a bit of reading. All they will be thinking about is who to blame for their own failures. This guy Nigel - he appears to be someone who has picked up a bit of programming from wherever, and has been let loose on a project where he is way out of his depth. He obviously doesn't have much of a clue about relational database basics, or messaging systems (or even programming in general). And rather than take advice on this, he has gone ahead and just written a total worse-than-failure.
Admin
Anyone else reminded of this bash quote? http://www.bash.org/?240849