Skip site navigation (1) Skip section navigation (2)

Re: Big Picture

From: "ken" <kenzo(at)kennethambrose(dot)com>
To: "Erik Price" <erikprice(at)mac(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Big Picture
Date: 2002-10-22 17:58:25
Message-ID: ANEFJNEGAHPHHGIKELIBIECKCJAA.kenzo@kennethambrose.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi,
 This question has come up in so many projects I have worked on. Here is the
overly-simplified rule I offer at the start of the decision-making process:

If a violation of the "rule" would result in nonsense data, the rule should
be in the db, therefore no rogue application code can ever violate the ruls.

If a violation of the "rule" would not result in nonsense data, simply a
business desire that is not followed, then I recommend to put the rule in
the middle layer.

Example:

Business decides not to sell guns online on Washington's birthday. This rule
goes outside the db. If a gun is sold in violation of the rule, the order
still makes sense, the customer got their product and the company got paid.

Business rule says each order line item must be associated to one and only
one order number.
 This rule goes in the db, obviously an order line without an order is
nonsense.

Admittedly this is an oversimplification, but it provides me with a very
useful rule-of-thumb for framing the debate.

Comments?

Ken

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Erik Price
Sent: Tuesday, October 22, 2002 2:52 AM
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] Big Picture



On Tuesday, October 22, 2002, at 03:08  AM, Joel Rodrigues wrote:

> Or, if one were looking for childishly (in programming terms) easy,
> instant/simultaneous web gratification, try putting as much of your
> application logic into SQL, use Python CGI scripting, and use a web
> browser interface. So simple.

Is "putting as much of your application logic into SQL" the preferred
way to develop DB-driven applications?  I ask this because the only
database I've used is MySQL, which I enjoyed learning about and using
but required me to implement a lot of the DB logic in my application
code.  (It was a PHP app.)  That's why I want to try PostgreSQL, to get
more experience with writing logic into the database itself.  But I was
curious if there are any resources that discuss why this methodology is
preferrable if indeed it is.

Thanks,

Erik

PS:  I agree that Python is a great language!





--
Erik Price                                   (zombies roam)

email: erikprice(at)mac(dot)com
jabber: erikprice(at)jabber(dot)org


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly


In response to

Responses

pgsql-novice by date

Next:From: Tom AnsleyDate: 2002-10-22 18:01:20
Subject: test
Previous:From: Brad PaulDate: 2002-10-22 17:32:37
Subject: a rule question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group