• Yet Another DBA (9/16/2014)


    courtney.smith (9/16/2014)


    It's not really a case of when business rules can't be done in the database it's a case of that its a pretty bad practice to duplicate rules or logic.

    At the end of the day the database is a storage tool and another medium is always there for presentation.

    As classes/models start to interact or are inherited / interfaced / abstracted from others, that's where an ORM really shines and there's no way a database can/should contain the logic like that. At the end of the day stored procs or views start to become a maintenance nightmare on any sufficiently large system.

    Also as things change in memory the system shouldn't be running of to the DB to ask it how to behave, that should be in the business logic which should be in your real world entities.

    I will show my age: I come from the era of client-server development and much preferred the rules in the database. Impact analysis was easier, scaling up was easier, security was easier.

    I too come from that era (through the standard passage of time). What I think is missed is that there can be a difference between business data rules and business application rules.

    As one may gather, I recommend that the appropriate place for business logic lies in its scope i.e. business data rules should exist in the database whereas application specific business rules belong outside the database (let's not discuss n-Tier architecture, or not, here).

    The key thing is that business data rules are always applicable regardless of the client application/system and when it changes in one system it requires changing all. Application business rules MAY be shared between applications but also MAY NOT. This belongs outside the database and it is up to the application developers to decide whether it is required to be produced as a component in order to facilitate reuse.

    Of course, some databases may be satellite DBs and are considered only as part of an application/sub-system as opposed to part of the enterprise data repository landscape.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!