[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP3] Database Design
From:       Richard Lynch <rlynch () ignitionstate ! com>
Date:       1999-11-08 18:46:32
[Download RAW message or body]

At 05:15 PM 11/8/99 +0300, you wrote:
>     Hi Guys, 
>Recently I have taken a look at the DDL code used in many of the Data Table
>used as part of PHP applications. And the one thing that strikes me is that
>the writer has unnecessarily worked very hard on the scripts. What I mean
>is let the under lying RDBMS do the work. I lot of time and effort could be
>save if Data Tables were properly designed. In the DDL I have looked at
>nobody has 'normalized' the tables, there is no use of referential
>integrity, no check contraints, etc. Good design would save hours of PHP
>coding. What about it guys?  This message is meant to open up a debate. It
>not meant the negatively critises (flame) anybody, so please don't be
>offended.  Best Regards 

I'm hardly a database expert.

But, I do agree that, for the most part, a common-sense layout of tables
generally comes pretty damned close to what an expert does, from what I've
seen.  And it's certainly not super tricky to focus on the tables, and try
to lay them out on paper with some sample data.  Even the least-trained
among us will fairly quickly come up with a decent design.  Might require a
lot of scratch-outs and starting-overs, but it's not that hard to
conceptualize.

The biggest problem I see facing beginning scripters is the lack of
standardization in SQL.

You can't even write the simplest database script in PHP without umpteen
*different* ways to create the table with auto-increment/serial/sequence IDs!

And don't even think about anything complex like triggers and referential
integrity:  There's no way to do that without tying yourself to a
particular database. :-(

In fact, I would contend that designing an application that relies on those
features too heavily is a bad design, for small to medium applications.
You end up too tied to the database engine, for minimal benefits.

After all, you *still* have to write code to handle the errors from the
database, unless you want some really ugly-ass messages in some odd places
in your HTML when the user enters bad data or tries to do to something
that's a Bad Idea (tm):  And if you're going to do that, you might as well
write some code up-front to prevent the error condition from happening,
since you can then avoid hitting the database as much.

I haven't seen the code in question, and maybe it has some really bad
design in it...  But there also might be some well-thought-out reasons for
why it's written the way it is too.

-- 
"TANSTAAFL"
http://CHaTMusic.com  Jeff Buckley Tribute http://EmphasisEntertainment.com
http://L-I-E.com        Uncommon Ground    http://JadeMaze.com
http://CatCatalani.com   1214 W. Grace     http://MGMH.com
http://AstraKelly.com       Chicago        http://OlivierLedoux.com
http://VoodooKings.net       11/17         http://UncommonGround.com
                               v
                http://UncommonGround.com/buckley/


-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe@lists.php.net
To subscribe to the digest, e-mail: php3-digest-subscribe@lists.php.net
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin@lists.php.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic