The basic idea behind using a rules engine is to simplify business logic in an application (or in some cases provide cross-application business logic).
The effect here is to remove hierarchical dependencies on logic conditionals and allow each condition (and subsequent action) exist on its own.
A simple example without forward chaining characteristics would be:
standard:
if(A){
if(B){
//do something
}
elseif (C){
//do other
}
}
else {
//do something else
}
engine:
if(A and B){
//do something
}
if(A and C){
//do other
}
if(not A){
//do something else
}
Yes, this style of logic can already be done in Java or any other language.
The trick comes in the performance of evaluating every possible condition over each iteration and re-evaluating those conditions every time the known data changes.
A useful drools example is forthcoming.
Comments
Post new comment