Tuesday, September 18, 2007

Business Rules as Usual

There will be some enhancements in the Oracle SOA Suite 11g regarding versioning of rules for Oracle Business Rules. Until then we will have to do with versioning of dictionaries and repositories. This topic will address some best practices I have with versioning and Oracle Business Rules 10.1.3.x.

Versioning of Dictionaries

Versioning of dictionaries aims at rules administrators, which can either be a business analyst or a developer. Versioning of a dictionary is done by saving a particular dictionary using another version number. Sounds trivial, not? Think again. The dictionary probably will work in combination with some application calling the rule engine, providing it with a particular version number to work with. So if you want to change something that should be effective immediately, you should save the dictionary using that particular version number. But what if there is a problem and you want to revert to the previous version? Or would you not rather want to be able to test your changes first before disrupting production? In other words, you want to be able to use at least two different versions: one to be used for testing and one for real.

What I always have is two dictionaries, one version for example with number 2.1.0 for production and another one with number 2.1.x for testing purposes. The test version I can always recognize by the 'x' at the end. Which version the application is supposed to work with, is read from a properties file that I can change on the fly. What I also could do, is create some preference screen through which the rules administrator can select the version to be used during a particular session, the one from the properties file being the default.

As property files can be written, that screen could easily be enhanced to allow changing the default. In this way the rules administrator will have a way to change existing rules or add new ones and test them first, before bringing them into production. The latter can be done by either overwriting the 2.1.0 dictionary with the 2.1.x version, or by saving the 2.1.x dictionary as 2.1.2 and set that as default. The rules administrator will also have the option to activate particular rules for a specific period of time, by putting them in a specific version, and set that as default only during that period.

Versioning of Repositories

Versioning of repositories aims at developers. The prime reason you might want to version repositories, is that during maintenance of the application the fact definitions may change. Fact definitions are dictionary specific, so why not version dictionaries instead? Of course you also use a particular dictionary to make the changes, but obviously you want to make sure you keep a clear track of what version of a repository works with what version of the application. And of course you are using some proper source control system like Subversion to manage you configurations, right? Right! And as that system probably is file based, you want the dictionary to be in a file you can put under version control, obviously.

So what I do is that with every change (or set of changes) I make and that have been properly tested, I make an export of the rules repository and commit that to the repository of the version control system together with the corresponding sources (XSD's or Java classes).

And business rules as usual.

1 comment:

victorculver said...

A business rule defines or regulates all aspects of your business, to support the corporate structure or affect the conduct of your business. Business rules are often focused on issues of access control, for example, teachers are allowed to change inputs and labels of students who attend seminars they teach, but is not influenced by the students in other seminars.
flight tickets