Re: Business rules in stored procs.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jacco Schalkwijk (NOSPAMjaccos_at_eurostop.co.uk)
Date: 05/07/04


Date: Fri, 7 May 2004 16:04:10 +0100

The second argument also ties your database design to one specific
application, something relational databases were explicitly invented for to
get rid off.
The last database that I worked on btw that was only accessed by one
application had only 3 tables. Every other database I have ever worked on
was accessed by multiple applications, quite often data imports.OO people
usually don't see imports from other systems as a separate application, but
unless you want to replicate your business rules all over the place or end
up with incorrect data, you better.

The truth as usual lies somewhere in the middle. Keep in mind that as soon
as you even define a datatype in your database (not to mention a foreign key
or a check constraint), you put a business rule in your database, so it's
very hard to avoid having business rules in both your database and your
application.

An interesting counter argument for "you can extrapolated your database from
your application" is made by Dataphor (www.dataphor.com), a framework that
allows you to derive your application from your database design.

-- 
Jacco Schalkwijk
SQL Server MVP
"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:uKoVjEENEHA.2676@TK2MSFTNGP12.phx.gbl...
>
> "Mark" <anonymous@discussions.microsoft.com> wrote in message
> news:9d1401c4343e$2c1273c0$a601280a@phx.gbl...
> > I have got into an argument with one of my colleague about
> > having business rules in stored procedures. He is saying
> > that no business rules should be described by TSQL. The
> > rules belong in the middle tier.
> > Can someone provide some serious thoughts about the
> > subject?
> >
> Opinion differs on this matter.  Also applications differ.  Also
middle-tier
> programming languages differ.
>
> In fact the one thing that most people agree on is that your application
> design should be consolidated in one place, to the extent possible.
>
> The strongest argument for putting business rules in TSQL is that your
> relational design, your constraints and your declarative referential
> integrity ARE business rules.  Therefore you should consolidate the rest
of
> the business rules in the same technology and tier.  This camp feels that
> the distinction between the "data tier" and the "business tier" is a
fantasy
> made up by people selling middleware technologies and/or O-O snake oil.
>
> The strongest argument for putting business rules in the middle tier is
that
> the application processes and procedures, and it's use cases ARE business
> rules.  Therefore you should consolidate the rest of the business rules in
> the same technology and tier.  This camp feels that the relational design
> can and should be extrapolated (trivially if not automatically) from the
> middle tier application design, and that stored procedures just tie your
> application to one vendor's RDBMS and add unnecessary complexity to the
> application.
>
> David
>
>


Relevant Pages

  • Re: Business rules in stored procs.
    ... >The second argument also ties your database design to one ... >unless you want to replicate your business rules all over ... >> the business rules in the same technology and tier. ...
    (microsoft.public.sqlserver.programming)
  • Re: limit of lines?
    ... Agreed, but don't let database design influence OO design, the two are not ... > part of the business rules it is not part of the navigation. ... Navigation should not exceed the business rules otherwise the rules end up ...
    (borland.public.delphi.non-technical)
  • Emergent DB ACID
    ... I think all business rules and business functionality belongs ... I will design my systems as though the database doesn't ... The high level code and business rules will have no knowledge ...
    (comp.object)
  • C# programmer looking for a job
    ... Software Development including Desktop, Client/Server and Database ... Practical skills in object oriented design and design patterns ... XML, Oracle, CVS, VSS, Delphi, bug tracking. ... Developed in Delphi5; ...
    (misc.immigration.usa)
  • Re: O/R Mapper
    ... | - create E/R model from niam model ... classes that contain, not only data, but also functionality as OO design is ... a database where they do not exist in the object model is corrupting the ...
    (microsoft.public.dotnet.languages.csharp)