Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic Business Rules in a web application

Greetings!

Working on a web based project were business rules and logic need to be customized by client. I want to do this without having to recompile the application every time we sign up a new client on the system. The architectures I have outlined so far are:

  1. Windows Workflow: Creating dynamic workflows and saving them to the database.
  2. Reflection: Creating a business rules interface and use reflection to load the custom client assembly.
  3. A true business rules engine
  4. Implementing an IOC Container like structure map. [zaff: added 6/4]

Have you ever implemented anything similar to this? If so, what is your experience? And finally is there another solution that I should be exploring?

Thanks for your help!!

like image 609
Zaffiro Avatar asked Jun 04 '09 01:06

Zaffiro


2 Answers

I have implemented most of the approaches you mention. The answer may depend on a variety of factors.

What client role(s) will be making the changes to the business rules (e.g. business analyst, developer, power user, etc.)? Meaningful support for business analysts may require a rules engine with externalized rules in a db and a useable UI. Meaningful support for developers might be as simple as leveraging something like MEF (http://www.codeplex.com/MEF).

You might also factor in how often will the business rules need to be changed and what sorts of associated operational requirements may apply (e.g. host process must remain running, app domain unloading ok, etc.). A good selection may require some careful thought about likely vs. unlikely future needs.

like image 144
Jason Weber Avatar answered Sep 28 '22 02:09

Jason Weber


You can do data driven business rules, like this. Decision trees can be a good way to go as well.

You might also think about aspect-oriented programming as a way to implement business rules.

My only caution with a Rete induction rules engine is that the rule sets should be kept small and close to the objects that use them. If you can encapsulate the behavior of an object in a rules engine that's part of its state, all the better. I don't care for the "enterprise" solution that dumps thousands of rules into a singleton rules engine that becomes a dependency for every part of the enterprise.

like image 31
duffymo Avatar answered Sep 28 '22 01:09

duffymo