I know it's probably not terribly nice to point out egregious cases of thoughtlessness, but someone linked to this as an example of why databases should just store data.
The thesis seems to be that FK and unique constraints shouldn't be in the database. Despite the fact that this was posted just a few days ago (this time I double-checked), this is an old idea. Why on earth does this foolish idea propogate? Are people not reading CJ Date and other authors? Are they not being taught the rules of normalization and, more importantly, why those rules are there? There are plenty of reasons why one needs to break rules but to break rules without understanding why is foolishness. Worse, the author of that link is trying to convince others to break rules the author doesn't understand.
This debate is as silly as the structured programming or goto debates. How is it that we still have developers who can't understand the benefits of data integrity? Of course, if I were ever to interview this person and not hire them on this basis, they would turn around and accuse me of "having drunk the Kool-Aid" or something similar and considered that a rational argument.
If you have one and only one (small) app that will ever write to the database, those constraints may never be noticed. It's sort of like omitting "strict" in a small script. However, once you have other apps or developers writing to a database, then those constraints will save your job or -- perversely -- lack of them may save your job as you take the unethical road to job security. Of course, "other developers writing to the database" might mean you next year when you've forgotten the code. Or if you're writing large-scale software for an application that requires five nines, no one wants to hear your excuse about why you didn't use FK constraints.
Naturally, as any good debater, the author addressed the issue of others writing to the database. I've no need to comment on it. It mocks itself.
As for the ongoing ââ¬Ëthe sky is fallingââ¬â¢ discussion about what if some other device accesses the RDBMS, itââ¬â¢s the same dilemma as ââ¬Ëwhat if some other person accesses our document, and starts changing it?ââ¬â¢ There are ways to manage that. Yes, weââ¬â¢re always exposed, always vulnerable to all kinds of attacks, but thatââ¬â¢s how life is. You should start getting used to it by now.
OK, OK, maybe I have no need to comment on it, but I will: oh no, oh no! We can't protect ourselves so we shouldn't try!
You know what, though? I used to be where that author is. It's a stage most of us go through and the fact that he tries to think about these things is a good sign. Maybe I would hire him -- next year.
I posted a pointer to this on some forum today but I can't remember which... Anyway, I totally agree with you, and EVEN SCARIER than what Dave said is the guy who felt that the database should be storing all data without types, similar to SQLite (about halfway through the thread):
Actually, I would prefer if all the values entered in the database would be of a single data type — text. This is because, at the end of the day, the data is mostly meant for human consumtion, and we consume it as text.
Regardless of what fancy data type may be sitting in the database, once it hits your eyes, it is plain text (whether displayed on the screen, or printed on paper). Also, even if it’s supposed not to be consumed by humans, but only by machines, it still gets converted to plain text (typically, XML).
So I really see no other point in having any type, other than plain string, defined in the database, other than to leverage the power of declarative programming.
Wow!
Re:Databases
Dom2 on 2005-10-07T12:22:41
In fairness, from what I can see, they're not trying to scale like that. Rails seems to be mostly concerned about the low end simplistic kind of stuff. You're going to run in to the limits of Active Record PDQ if you've a complex database you're trying to plug into. But that's exactly the same as Class::DBI. You've got to be aware of the tools you're using and what their limitations are.-Dom