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.
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
Admittedly this is an oversimplification, but it provides me with a very
useful rule-of-thumb for framing the debate.
[mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Erik Price
Sent: Tuesday, October 22, 2002 2:52 AM
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.
PS: I agree that Python is a great language!
Erik Price (zombies roam)
---------------------------(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
pgsql-novice by date
|Next:||From: Tom Ansley||Date: 2002-10-22 18:01:20|
|Previous:||From: Brad Paul||Date: 2002-10-22 17:32:37|
|Subject: a rule question|