Re: Flamewar object databases vs. relational databases
Date: Sat, 21 Jul 2001 23:29:07 GMT
Message-ID: <9f9hcd$ntv$1_at_geraldo.cc.utexas.edu>
In comp.databases Carl Rosenberger <carl_at_db4o.com> wrote:
: No. : It took 15 minutes to write the code and 1 hour and 45 minutes to debug : SQL-string-errors that were not detected by the compiler.
Wasn't Java promising faster development times?
: It is a little more than "Insert Contract". : Did you take a look at the 50 unnecessary lines of code?
I did, and I found it more than a bit disingenous given that all those lines deal with Java type conversions and string concatenations. Don't blame the database for a language's poor type system and string hostility.
Here's how you would do it in Perl connecting to Oracle:
$dbh->begin_transaction; # or whatever
$personID = $dbh->selectrow_array("select personID_seq.nextval from dual");
$errno = $dbh->do("INSERT INTO brm_PERSON (ID, NAME) VALUES ( $personID,
'$contract{customer}->{name}')");
$dbh->rollback unless $errno;
$cust_id = $dbh->selectrow_array("select customerID_seq.nextval fromdual");
$errno = $dbh->do("INSERT INTO brm_CUSTOMER (ID, PERSONID, CUSTOMERNO
) VALUES ( $cust_id,$person_id,'$contract{customer}->{customerNo}')");
$dbh->rollback unless $errno;
$doc_id = $dbh->selectrow_array("select personID_seq.nextval from dual");
$errno = $dbh->do("INSERT INTO brm_DOCUMENT (ID, TITLE, CREATIONDATE
) VALUES ($doc_id, '$contract{title}','$contract{creationDate}')");
$dbh->rollback unless $errno;
$errno = $dbh->("INSERT INTO brm_CONTRACT (ID, DOCUMENTID, CONTRACTNO,
SUBJECT, CUSTOMERID) VALUES (contractID_seq.nextval, $doc_id, '$contract{contractNo}', '$contract{subject}', $cust_id)");
$dbh->rollback unless $errno;
$dbh->commit;
13 statements, 18 lines of code. I tried to make it simple -- this sequence could be done in 8 statements, or 5 if you jigger the key generation. If you call me on it, I'll happily write that - I just didn't want to hear "I can't understand Perl" from anyone.
You'll notice the above code is transactional, whereas yours was not.
Others would more happily take you to task for data model decisions; I only contend that 4 inserts is a bit much for this application.
Also, if dealing with text streams is so onerous (such that 30 years of Unix programmers have been happy with it) you can certainly write your own OCI interface.
: We have logical advantages because we can regenerate the complete object : network to the state it was stored.
I'm not convinced that's a great thing, given that your example isolates customers inside contracts, and there is no constraint ensuring integrity between Customer.customerNo and Contract.customerNo.
:>
:> Algorithmic replacement. No code changes. Sounds like a bargain to me!
Yeah,
:> baby! YEAH!
: Sounds like good drugs.
This debate could certainly use some, that's for sure; but I fear you missed Bob's point that relational DB's dynamically adjust query paths whereas OO-network DBs are more constrained. Received on Sun Jul 22 2001 - 01:29:07 CEST