[DUG] Stored procedures and business logic

Neven MacEwan neven at mwk.co.nz
Fri Jun 2 12:19:25 NZST 2006


Karl

All the constraint/ri ui code can a) be extracted out of the DB or b) be 
autogenerated from metadata

 > Where does referential integrity end and business logic begin anyway?

firstly I make the distinction in the respect that a change in business 
rules should not alter your ri, the difference is breaking ri would 
result in "what the sh#t is this", breaking business rules results in 
"should we be allowing this sh#t"

Its basically the same mismatch that exists between an OO system and a 
Relational Database, it all goes away if you accept/assume that a row of 
a table is a class instance persisted, the question is should you?

Neven


Karl @ Work wrote:
> Neven wrote:
>> b) Because the DB Server enforces the rules you have to have the UI
>> guiding the user otherwise its a 'chuck at the db and see
>> what happens'
>> UI (ughh). if you do this then you have duplication in business logic
>> (in the ui and the db) and therefore the inevitability of errors
> 
> What about foreign keys and unique indices?  Or database constraints?  To
> push your statement to its logical conclusion, such things could all be
> checked at the UI stage and they could be left out of the db entirely.
> Personally, I think it's perfectly reasonable to have stored procedures (and
> triggers) do similar checks on data validity to ensure that no code slips
> ever permit crap into the database, which it seems to me was what Kurt was
> advocating.  So you might end up duplicating some logic at the front and
> back ends, but not to cause errors - to catch them.  Just like foreign key,
> unique index and other constraints, stored procedures to do referential
> checks on data validity are a safety net.
> 
> Where does referential integrity end and business logic begin anyway?
> 
> Cheers,
> Carl
> 
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
> 
> 

-- 
Neven MacEwan (B.E. E&E)
Ph. 09 620 1356 Mob. 027 4749 062

New Address Details
===================
MWK Computer Systems
1 Taumata Rd
Sandringham
Auckland

Ph 620 1356
Fx 620 1336
-------------- next part --------------
A non-text attachment was scrubbed...
Name: neven.vcf
Type: text/x-vcard
Size: 164 bytes
Desc: not available
Url : http://ns3.123.co.nz/pipermail/delphi/attachments/20060602/dce699a6/neven.vcf


More information about the Delphi mailing list