• Gary Varga (11/2/2015)


    I agree with the school of "the right logic in the right layer".

    Me too! 🙂

    It usually seems to me that most people tend to take what I would call extremist doctrinaire views on this topic. Even some fairly specific area of business logic will be best split between database, middle layer, and front end.

    Providing information and entertainment for a customer, for example, requires a lot of data, and is best done with business logic split between all layers. That requires knowing what customers' preferred languages are (and knowing when they change, whether temprarily or permanently), knowing which information sets are available in which languages, whether a customer has fall-back languages for information which isn't available in his preferred language, and so on. So there's a lot of data in the database, and ensuring that it meets the requirement that its possible values are only those (and ideally all those, subject to capacity constraints) which represent valid states of the real world is business logic (data integrity and expressive adequacy) that definitely belongs in the database. But laying out text depends on display/print device characteristics as well as language-specific (and sometimes customer-specific or individual-specific) layout rules and actually determining the layout needs to be in the front end. Turning customer requests passed in from the front end into appropriate requests on the database, and turning the results of those requests into responses that the front end can convert into something to deliver to the customer doesn't happen in the database or in the front end, it's in the middle layer.

    So I very much agree with

    xsevensinzx (10/16/2015)


    So, to answer the question, "Where should middle tier business logic be stored?" It depends... How tall is a tree? :hehe:

    and with

    dallas-1069889 (10/16/2015)


    Why should we have to decide which layer it goes into?

    and with

    Chris Harshman (10/16/2015)


    There's data logic, process and workflow logic, and interface logic.

    Tom