Wednesday, July 30, 2008

Implementing business rules

This is the first post about implementing business rules in an Oracle database. In the previous millenium I've implemented them a lot using CDM RuleFrame and its business rule classification scheme. This was all done using Oracle7. And business rules were either implemented using check constraints or, most of the time, using database triggers. Since then, a lot has changed, which have changed my preferred way of implementing business rules. These changes include:

  1. The current Oracle database version is now 11gR1. Since version 7, a lot of new techniques have become available to use when implementing business rules. Examples of these are function based indexes, on commit refreshable materialized views and virtual columns.

  2. Database triggers are considered evil, or at least by me.
Also, there are people out there, even some intelligent ones, who claim that business rules should be implemented in an application logic layer and not in a persistency layer. I suspect that all readers of this blog will not agree with that because the data is most important to a company and not the application. And so, business rules should be implemented closest to the data: in the database. But just in case you need a little persuasion, I've collected a few links. Needless to say, I agree with them all heartily.
So now we are clear that business rules should be implemented in the database, and we can move on to the business rule classification scheme. This scheme hasn't changed over the years; it is as applicable now, as it was ten years ago. With a business rule classification scheme you can categorize all business rules that you have thought of during your analysis phase. And when you have categorized them properly, you will see that most business rules of the same category are implemented the same. So when implementing business rules, a business rule classification scheme is indispensable. CDM RuleFrame uses the one below, which I like. You can also see this scheme here.







In the next posts I will walk through this classification scheme and discuss for each class how a business rule can or should be implemented nowadays in my opinion.

Next posts:
Implementing attribute and tuple rules
Implementing entity rules
Implementing inter-entity rules
Implementing dynamic data constraints
Implementing change event rules

3 comments:

  1. Anxiously awaiting your next posts...

    Toon

    ReplyDelete
  2. Help! I've recently inherited an old Headstart/RuleFrame-ridden database. Oracle seems to have deleted all of the documentation and software related to these products. Do you know where I can find them?

    ReplyDelete