Category Archives: Questions

Rules Engine or Scripting Engine?

The question is which approach is better? The initial thought/requirement is that business users should be able to quickly adopt to changes in business and so, the rules engine provides them an easy way to quickly modify the business logic. But if only the business logic is so simple that one can simply change from + to – (markup vs discount). Those simple if then else rules soon become complex statements, blocks, built-in functions and soon a whole set of new language emerges and no longer in the reach of the business user to write them.

Perhaps when the scripting was not popular/well explored and thanks to the hype of AI in the earlier decades, the concept of rules engine came into existence. But with a better undersanding of scripting languages and the ability make them co-exist with compiled languages (c + tcl, java + beanshell a few examples), are rules engines lucrative anymore?

Yes, I do understand there is farward chaining, backward chaining, hybrid chaining and all that stuff and for that there are languages such as Prolog and Lisp that are very good at. But, deductive reasoning shouldn’t be confused with much of the business rules. I mean, it’s not like much of the auto-insurance policy rules have to go through a 10-level deep tree with 1000s of nodes before finding a solution. Or is it? I could be wrong, but hope not. Otherwise, it will be hard for me to compare and get the best deal :). So, I am not talking about knowledge based expert system type of rules engines.

I think the main issue is, going with hard-coded logic, it’s possible to do very complicated and optimized logic. Going with simple rules engines that are easy enough for business users, a few simple cases, perhaps even 70% of cases can be solved. But what about the rest? It’s the in-between cases that cause the problem. So, going with business rules perhaps is going to leave a gap.

However, using an embedded scripting engine, it’s probably possible to address the needs of both simple and medium complex problems. Infact, it may be possible to solve even the most complex problems, albiet a little slower (performance and not coding).

Frankly, if someone is telling that a business guy would know to write excel type of functions and branching logic such as IF(a,b,c), and can’t understand if(a) then b else c; then there is something fundamentally wrong in that assumption. I think it’s not the simple syntax that is the problem, but the overall logic of the code that makes it difficult.
And especially, if the data for the logic is in the database, the seamless way of fetching the necessary data, the sqls, the transaction and commits, in memory data vs database data and so on. These are the things that make things more complex, and not the simple syntax of rules.

All said and done about rules, Oracle 10g has an interesting rules engine that is event based. Pretty cool stuff and has more practical use than what conventional rules engines or programs can offer.

Those interested in scripting languages can further explore with these scripting languages books.

Leave a comment

Filed under Database, Questions, rules engine, Scripting