Re: OOP - a question about database access

From: Bob Badour <bbadour_at_golden.net>
Date: Fri, 7 Nov 2003 19:31:03 -0500
Message-ID: <tv6dnTss4O31pDGiRVn-tg_at_golden.net>


"Christopher Browne" <cbbrowne_at_acm.org> wrote in message news:bogm5j$1ef99t$2_at_ID-125932.news.uni-berlin.de...
> After takin a swig o' Arrakan spice grog, Costin Cozianu
<c_cozianu_at_hotmail.com> belched out...:
> >>>
> >>> If recognized OO writers show this "understanding" of the data
> >>> management issues, imagine the rest.
> >> The above comments from Bob do not have any relation to "data
> >> management issues". Why would a database be a good place to validate
> >> text from an input field, wouldn't it make everyone's life a lot
> >> easier if data were validated before making a write to a DB?
> >
> > Well, just because you typically *have to* do it in three places
> >
> > 1. First in the client (JavaScript)
> > 2. Second in the middle tier (ASP.NET, Java, etc. )
> > 3. Have it as a constraint defined in the database.
> >
> > Any solution less than all three is pretty much guaranteed to be a bad
> > solution

>

> It's fair enough to say that you'd like for the enforcement to take
> place at all of those levels.

It's fair enough that the dbms must enforce integrity. I question the need for the three tiers mentioned. The dbms can encompass all of them.

> I agree that it improves things to have a constraint applied in
> multiple places, as opposed to _solely_ in the DBMS.

Does it? Why?

> After all, it's going to be really irritating to fill in a web page
> with a bunch of data, and only discover that the values are Seriously
> Messed Up when you try to COMMIT the transaction to the database and
> discover it doesn't work out.

It's also irritating when an error message prevents one from moving focus to fill in a field that would make the current field valid. I suggest it is even more irritating to discover that all of one's data is messed up because someone installed an old version of an application.

> The Right Way involves having some way of querying the database about
> "Constraint Metadata", and then having some sort of code generator
> that can transform that into Java/JavaScript/Perl/Python as needed to
> support the upper layers of the system.

Why do you assume this "code generator" is external to the dbms?

> I think it's a real attractive idea to automate creating validation
> rules that can be pushed upstream, but that doesn't make it easy...

I suggest it is no harder for the dbms to enforce constraints on one computer than on another. Received on Sat Nov 08 2003 - 01:31:03 CET

Original text of this message