InfoQ Article: Real World Rules Engines

| by Floyd Marinescu Follow 38 Followers on Jun 19, 2006. Estimated reading time: less than one minute |
Rule engines are a useful tool that can be used to externalize business logic, involve business users, or solve certain classes of problems in an efficient way. In this InfoQ Article, Geoffrey Wiseman explains what, when, and how to use rules engines along with his experiences applying them in finanicial services.

The articles introduces rules engines, shows some example architectures, performance and management issues, patterns and anti-patterns:
In general, you might consider a business rule solution if you need to externalize business rules, support rapid change and empower business users to change business rules. You'll get the most out of a rule engine if you accept the new paradigm by relinquishing flow control, using fine-grained rules and objects, avoiding cross-products, and understanding the combinatorics and recursion that a rule approach can create.
Read Real World Rules Engines.

Note: Content on InfoQ is now printer-friendly.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Business rules engines v Business rules management systems by James Taylor

Great article, especially on why to use a business rules technology - I listed my own view of benefits here.

I do think it is worth making the point that there is a significant difference between a business rules engine (typically with a fairly technical syntax and limited rule management) and a true business rules management system (with repository, repository and version management, multi-platform execution etc etc). I spent some time writing about the difference here but it comes down to making it realistic for business users to maintain rules.

In the interest of fair disclosure I do work for a vendor (Fair Isaac who produce Blaze Advisor) but I maintain what is a fairly vendor independent blog including documenting some FAQs on business rules and some ideas on selection requirements.

Lastly a quick syntax comparison.
Here's the Blaze Advisor syntax for the first example:

If thisCar's color is "red"
and thisCar is aSportsCar
and thisDriver is aYoungMale
then thisPolicy's premium = thisPolicy's premium * 1.2

BTW this syntax uses a couple of patterns for clarity:

aSportsCar is any Car having class=...
aYoungMale is any Driver having sex="M" and age >=16 and age <=25

Nice! by Daniel Selman

I have posted a link to your informative article at where we try to keep an eye on goings-on in the rule engine world.

Daniel Selman

Re: Business rules engines v Business rules management systems by Michael Neale

It is a great article, thanks for that Geoffrey.

I agree with James that a BRMS (if I may use that phrase) is very much a superset of an engine (perhaps even a seperate beast in some sense).
A disclaimer : I work on JBoss Rules myself.
In drools we have a template based way of extending the language, which means you can express rules in natural style terms, its quite simple (people seem to like it though).
so with the appropriate mappings you could do something like:

Set the policy to : 'p'
Drivers sex is : male
Drivers age is between 16 and 25
Cars style is SPORT and color is RED
Increase the premium on policy 'p' by 50 %

I came into the rules world from a background of working with projects that used BPM and rules, and it was a real eye opener.
It is somewhat of a "holy grail" to have business users owning and managing rules that control their business: from what little I know, I can see that there are 2 camps:

One believes that templates/forms are the best way to provide control to business users (backed by a rule management system) and the other thinks a natural language variant (which means learning really simple mini programming language) is the way to go (also backed by a rule management system of course). They both sound good to me (with the right tools)!

The problem is it is hard to tell what works/doesn't work other then anecdotal evidence. For each whitepaper I see, I have talked to 3 or more companies who are shell shocked by being left with a very proprietary system which they are afraid to touch (which was sold on the basis of "you don't need to code, just let you business users click on these screens"). Unfortunately for them, the original knowledge keepers of the system moved on and left them with something horrific (and the business users never touched it not even once). So that leaves people bitter and skeptical over the grand claims (rightly so) - and yearning to go back to goode olde fashioned code like Mum used to bake (baby out with the bathwater so to speak). Of course, I would expect the industry has moved on since then.

Its certainly an interesting fun time in an interesting field !

Re: Business rules engines v Business rules management systems by peter lin

This paragraph from the article doesn't make any sense from a rule engine perspective.

"To avoid duplicate items in your rule, simply add a condition that the first item not be the same as the second, removing the following tuples: (Adam, Adam), (Beth, Beth), (Chris, Chris) and leaving these six: (Adam, Beth), (Adam, Chris), (Beth, Adam), (Beth, Chris), (Chris, Adam), (Chris, Beth)."

No rule engine should ever compare an object to itself as described above. Forgetting the algorithm the engine uses, a rule engine should evaluate the attributes of the object against literal values or other object instances, but it should never compare to itself. If a rule engine does that be design (aka on purpose), it's just plain wrong. If a RETE rule engine does that, it's probably a bug caused by human error.

I should state that I am bias, since I work on rule engines. I don't know if the author of the article understands how rule engines work at a low level, but that statement is wrong on all levels.


Re: Business rules engines v Business rules management systems by Geoffrey Wiseman

It was true in Drools 2.X, and in some cases, it was also what the rule author might have wanted. In Drools 3.X, the syntax has changed significantly, and it is easier to choose between those two options without having to write a condition to prevent them:




So, depending on the rule engine you're using, it's a valid concern, and wasn't wrong. There's a pile of references on the mailing list if you care to dig through it, but here's one example.

Business rule management is a lot more than just having a rule engine by Oliver Eiholzer

From the business point of view you have processes which define what the business does, and rules that define how it is done.
So business rules management does not only mean managing a set of rules and versions.
BRM should also handle:
- Who is responsible for the rule (Maintenance)
- Management of concepts and facts (As decribed by Ross)
- On what source is the rule based (Law,..)
- At which step of the business process has the rule to be applied
- How is the rule implemented (Rule engine, handbook, ...)

Unfortunately business rule management 'systems' sold these days by rule engine tool vendors don't take into account these issues.
In my experience it's far more difficult to introduce BRM on the business side than integrating a rule engine in a IT environment because especially the business people have to adjust their way of thinking(If-then, instead of do-this-and-then-do-that).

In my current project we use TopEase to do manage(facts, concepts, sources, responsibilites, ...) the rules on the business side and the rules that make sense to automate, we implemented with Blaze Advisor as rule engine. This approach works great because the BRM tool is really for business people and it is not depending on the execution engine.

Real-World Rule Engines by Mohit Manrai

Great Article!!

Re: Real-World Rule Engines by Geoffrey Wiseman

Glad you liked it; hope it was useful to you.

Re: Real-World Rule Engines by Thomas Cozzolino


Can you comment on the current state of the industry in migrating rules (e.g., COBOL-based logic) into the Nirvana of the BRE? Has anyone characterized a rough Cost/Benefit Analysis of such work? I am working with a client who has asked for some of this thinking and am researching the area.

Thank you for a terrific article.

Re: Real-World Rule Engines by Dee si

Thanks for this great article. My company uses Drools, wants to purchase Pega plus work with someone who created a home grown rules engine. How can we make these applications integrate? What are the pitfalls?

PHP Integration by Murthy Gudipati

Hi. Very good article. Do you know if there are PHP compatible rules engines ?

modifying business objects by peter wachira

thanks for an informative article; I am working with a decision support system that has a lot of rules currently in (surprisingly well maintained). I want to eventually steer into rule engines such as inrule/drools to delegate business logic to our business analysts; one thing I rarely see in demos and articles is a concrete sample of injecting a set of related business objects into the engine, say from an orm like hibernate, running them through rules and persisting the results. All demos I come across stop at 'fireallrules'(which is further than you went here :)... letting me inspect a console output for a simple example

business rules engine by Om Visvanathan

You can check out 'Acuity Business Rules composer' from Acuity lets you create and run declarative business rules of the if-then format.

founder and ceo,
Business rules for everyone

Great article by Nicolas Billard

Thank you for this article, which provides a very good summary on when and why use a rule engine.

I'd like to add an opinion : for me, libraries like Drools (or Jess, JRule, OpenRules, etc ...) are fine for systems with a large amount of complex rules. The usage of RETE algorithm has disadvantages (memory impact, etc...) and their syntax is often complex. Also note that depending on how you write your rules, performance might dramatically degrade...

For smaller system, or for management applications with lots of business logic, other implementations, more sequential, are a lot simpler to configure. Performance are not necessarily less good than native code, if internal optimizations (like caching, etc) is used. A non exhaustive list of implementation could be EasyRules, DTRules, MRules, ...

Java Business Rules System.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

14 Discuss