What problem/s does a Rule Engine Algorithm solves? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
开发者_运维百科Closed 5 years ago.
Improve this questionWhat problem/s does a Rule Engine Algorithm solve?
Which are the recommended ones?A rules engine can encapsulate business logic, often in a declarative manner. This avoids the need to custom-code business logic in software.
A rules engine algorithm is how the rule matching and triggering is implemented, so it's an implementation detail rather that actually solving a problem itself. Algorithms might have different non-functional strengths or weaknesses. A common example of a rules engine algorithm is the Rete Algorithm, used in the Java rules engines JESS and Drools.
The problem is just too fiddly for traditional code: The problem may not be complex, but you can't see a non-fragile way of building it.
The problem is beyond any obvious algorithm based solution: It is a complex problem to solve, there are no obvious traditional solutions or basically the problem isn't fully understood.
The logic changes often: The logic itself may be simple (but doesn't have to be) but the rules change quite often. In many organizations software releases are few and far between and rules can help provide the "agility" that is needed and expected in a reasonably safe way.
Domain experts (or business analysts) are readily available, but are nontechnical.
Taken from this site
At the lowest level, a forward-chaining rule engine allows you to structure rule sets (often large rule sets) in roughly the following way:
if (Condition A) {assert (Condition B)}
if (Condition C) {assert (Condition B)}
if (Condition B) {do something}
The conditions can also have parameters:
if (Condition A (X, Y)) {assert (Condition B (X)}
if (Condition C (X)) {assert (Condition B (X)}
if (Condition B (X)) {do something with X}
These chains could be as deep as you want. The Rete algorithm and its variations allow efficient processing of large rule sets.
The problem that rule engines solve is to separate maintenance of the rule sets from the application - the rules can be reconfigured without having to rebuild the application. While (in theory) non-technical analysts or SMEs could maintain the rule sets themselves, in practice it takes a bit of technical savvy to avoid shooting yourself in the foot on a complex rule set - and rule engines are a bit pointless if you don't have a large rule set.
Where rule engines really shine is where the rule set is large and changes often, or where they are built into packaged applications and used to configure the application to support customer-specific business rules or workflow triggers.
A rule engine calculates a decision, based on one or several input parameters.
Rules engines tend to try and solve problems that change frequently or are sometimes poorly defined quickly and easily.
They are not very complicated and many implementations present serious performance and scaling challenges.
精彩评论