robert young
Posts: 361
Nickname: funbunny
Registered: Sep, 2003
|
|
Re: Gavin King: In Defence of the RDBMS
|
Posted: May 29, 2007 7:54 PM
|
|
> > Well, the argument is that the application code is too > > complex. Couldn't possibly be described in RDBMS > > constraints. But consider: any constraint on the data > > that isn't in the database constraints must be HARD > CODED > > in the application. How many coders would admit to > doing > > that? And now, the database no longer knows whether > its > > data is consistent. If you don't care whether the > > database is consistent, then why bother with a > database? > > Suck it up, and just write purpose built files, > > , multi-user transaction manager, etc. And, if the > coder > > knows what to HARD CODE in the application, and the > > database is intended to be consistent, then why not put > > the behaviour of record with the data, where it won't > get > > lost? > > This barely even makes any sense. > > In a web application it's often necessary to express the > constraints of > the data model in more than one location. Once in the > database to ensure > data integrity, a second time in Javascript so that a user > doesn't have to > submit a form before realizing they've made an error, and > a third time in the > application server if you want to do data validation using > AJAX, or if you > would like to handle invalid data error messages in a sane > fashion.
It makes sense if one views constraint definitions as a Repository responsibility. That's what database driven frameworks do: generate UI editing code which is a (user friendly) duplicate of the database constraints. I never said that constraints are *only* enforced at the database; only that the "constraints of record" are stored there. The app server, UI, or Aunt Milly can have their own versions (language specific). Folks happily slog through XML to generate code (I work with such a kludge). I'd rather do it from the database.
> > For example, if you need to express an invariant (field A > > 10 if field B is < 5), > and your only method of detecting invalid data is > attempting an INSERT > into a relational database, it seems like it would be > quite difficult to > convey that data input error to the end user in a manner > that they could > understand.
Just provide a User Friendly string for the SQLCode. Standard practice. Again, generable from the schema.
> > In my experience, the data model and integrity expressed > by a database has > the tendency to evolve towards a schema that promotes > performance.
If you mean "I denormalize for speed"; not on my watch. With cycle and memory costs reaching the noise level, 5NF databases are more logical than ever. Buffer the piss out of the tables; performance will be fine. There's a recent article, don't have the cite (Coding Horror, IIRC), that Google has found that the majority cost of ownership is all those electrons needed. Hardware isn't it. And then there's the multi-core issue of parallelism; RDBMS builders have been doing that longer than anybody else. They know how to do it better. There will come the time when such multi-beasts won't go faster on serial code (Amdahl's law). So, the only feasible way to get more throughput is with inherently parallel code. That's the database. The PC becomes just an Xterm, or 3270.
Where as > the UI simultaneously evolves in another direction to > support a user interface > that supports usability.
Well, again, KISS. The relational model strives to simplify as much as possible; one fact, one place, one time.
And for those who think AJAX is some new way of doing things: Unix database/VT-100 systems from the 1980s provided character mode interface out of the box. Nothing new.
|
|