Pros and Cons on where to place business logic: app level or DB

Posted by Juri on Stack Overflow See other posts from Stack Overflow or by Juri
Published on 2010-03-24T06:52:16Z Indexed on 2010/03/24 6:53 UTC
Read the original article Hit count: 313

Hi,

I always again encounter discussions about where to place the business logic: inside a business layer in the application code or down in the DB in terms of stored procedures. Personally I'd tend to the 1st approach, but I'd like to hear some opinions from your part first, without influencing you with my personal views. I know there doesn't exist a one-size-fits-all solution and it often depends on many factors, but we can discuss about that.

Btw, we are in the context of web applications and our current approach is to have

  • UI layer which accepts UI input and does a first, client-side validation
  • Business layer with a number of service-classes which contains the business logic including validation for user input (server-side)
  • Data Access Layer which calls stored procedures from the DB for doing persistency/read operations

Many people however tend to move the business layer stuff (especially regarding the validation) down to the DB in terms of stored procedures.

What do you think about it? I'd like to discuss.

© Stack Overflow or respective owner

Related posts about web-development

Related posts about architecture