Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros and cons of Java rules engines [closed]

What are the pros and cons to adopting the Java rules engines JESS and Drools? Are there any other players?

I understand that Drools is Open Source and JESS is not, but how do they compare in other areas like ease of use, performance, level of integration with your code?

like image 986
brabster Avatar asked Jan 30 '10 09:01

brabster


People also ask

Should you use a rules engine?

For software developers, a rule engine is useful only if it liberates them from expressing the rule in the code. In order to avoid this pitfall, it is commonly accepted that we should use rule engines only if appropriate, or not use them at all. Over the past decades, that has become a self-fulfilling prophecy.

Which is one of the greatest benefits of a rules engine?

One of the main benefits of using a business rules engine is that updates to the rules do not require making updates to the rest of the application code.

Why do we use rule engine in Java?

A solution is to have a rule engine, which is basically a set of tools that enable business analysts and developers to build decision logic based on an organization's data. The rule engine applies rules and actions as defined by end users without affecting how the application runs.


1 Answers

What are the pros and cons to adopting the Java rules engines JESS and Drools?

Use a rule engine if you need to separate the business rules from the application logic. The Does Your Project Need a Rule Engine article has a good example:

For example, a typical storefront system might involve code to calculate a discount:

if (product.quantity > 100 && product.quantity < 500) {   product.discount = 2; } else if (product.quantity >= 500 && product.quantity < 2000) {   product.discount = 5; } else if (product.quantity >= 2000) {   product.discount = 10; } 

A rule engine replaces the above with code that looks like this:

ruleEngine.applyRules(product); 

Up to you to decide whether putting a rule admin console in the hands of non-technical people is a good thing or not :)

More details in Should I use a Rules Engine?, Why use a Rule Engine?, Some Guidelines For Deciding Whether To Use A Rules Engine and on Google.

Are there any other players?

Other players include JRules, Corticon (JRules is the most famous IMO - which doesn't mean the best).

how do they compare in other areas like ease of use, performance, level of integration with your code?

Can't tell you precisely, I only have a little (positive) experience with Drools. But you'll get some feedback from blog posts like JBoss Drools vs ILog JRules - an anecdotal story (be sure to read it) or Working with Drools from a JRules perspective. I'm sure you can find more of them on Google (but I would give Drools a try).

like image 162
Pascal Thivent Avatar answered Sep 30 '22 15:09

Pascal Thivent