Business Logic: Database or Application Layer

前端 未结 24 3353
春和景丽
春和景丽 2020-11-28 02:50

The age old question. Where should you put your business logic, in the database as stored procedures ( or packages ), or in the application/middle tier? And more importantly

24条回答
  •  天涯浪人
    2020-11-28 03:28

    Business logic is to be put in the application tier and not in the database. The reason is that a database stored procedure is always dependen on the database product you use. This break one of the advantages of the three tier model. You cannot easily change to an other database unless you provide an extra stored procedure for this database product. on the other hand sometimes, it makes sense to put logic into a stored procedure for performance optimization.

    What I want to say is business logic is to be put into the application tier, but there are exceptions (mainly performance reasons)

提交回复
热议问题