views:

264

answers:

3

Hi,

how do I externalize the business rules from the business processes so that I can add rules without touching the business process logic?

For example, I have two business processes, say "Add Product" and "Update Product", there are a few common rules that these 2 processes share, and rules can keep getting added later. I intend to write the business process once, which executes all the rules available for a particular process, and if no exception is thrown, continues to complete the business process successfully.

I do not intend to use a rules engine as I think this might be too heavy for my architecture.

Thanks and Regards,
Ajay

+1  A: 

The answer to this question is more complicated than I could write here. This touches on the sciences of data relations, security, policy doctrine, and administrative constraints of your business/industry.

I could be misinterpreting your question if you meant something less vague than "business rules" and "business policies".

A: 

The questions is quite broad so I will answer in terms of a general pattern.

What I have done in many cases is to define the process such that one inserts a number of "gate-keeper" activities at appropriate stages in the process. Each of these gate-keepers is responsible for enforcing a particular sub-set of the business rules. So, for example, one such activity might enforce data quality. Another might make a routing decision based on business rules. Another pricing. And so on.

The actual rules themselves are held external to the workflow and can be modified independently of it. The trick is to constrain the "process consequence" of the rule evaluation so that one can continue to have a predictable (and testable) process.

Raoul
+1  A: 

You can separate the rules from the flow of the process with many techniques. At some level of abstarction you are calling a "method" from various points in your Business Process. The question then becomes one of the mechanisms by which that method can be modified without changing the Business Process itself.

One could package the method in its own library (dll, jar or whatever) and replace that jar with a new version. Change the library, change the business rules.

One could express the logic in the method in terms of configurable paramteres obtained from a database. Change the database, change the business rules.

If the complexity rises enough you find that you have implemented your own rules engine.

At some point it becomes more efficient to use an existing rules engine rather than reinventing this wheel.

For more detailed advice you need to tell us more about what you are doing.

djna