From: Josh Berkus <josh@agliodbs.com>
To: gry@ll.mit.edu
To: pgsql-sql@postgresql.org
Subject: Re: Design Q.:logic in app or db?
Date: Wed, 26 Feb 2003 10:25:00 -0800
Message-ID: <200302261025.00360.josh@agliodbs.com> (raw)
In-Reply-To: <20030226103220.6875cee9.gry@ll.mit.edu>
References: <20030226103220.6875cee9.gry@ll.mit.edu>
George,
> I have general design question about Postgres usage: How does one decide
> how much, and what parts of logic should go in DB rules, triggers,
> functions, constraints etc, versus what should go in the application?
Ideally, this should be done strictly on the basis of carefully planned design
architecture, where each business rule is implemented at the application
level where it is most effective, such as referential data integrity in the
database and security in the middleware.
Realistically, business logic tends to be implemented in the layer where you
have the most programming expertise. The people on this list are often
expert DBAs, so they implement as much business logic as possible in the
database in the form of views, triggers, and rules. However, I"ve seen
plenty of shops with multiple crackerjack Java programmers and a weak DBA
implementing all of their business logic in the middleware.
> The main thing not done yet is to facilitate ad-hoc queries
> (via odbc excel etc.) from db-naive users: maybe restructuring the
> db to make it simpler, maybe views and functions... The data is
> somewhat complex in structure.
This desired feature would argue strongly in favor of putting as much business
logic as possibly in your database in the form of views and rules. If users
can bypass the interface and middleware, you cannot rely on it to enforce
data integrity and access control.
--
Josh Berkus
josh@agliodbs.com
Aglio Database Solutions
San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, gry@ll.mit.edu
Subject: Re: Design Q.:logic in app or db?
In-Reply-To: <200302261025.00360.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox