Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guidelines for implementing a rule engine

What could be the reasons to implement your own rule engine instead of using an existing commercial/open source one? Any specific guidelines for implementing rule engines?

like image 497
Snake Avatar asked Mar 12 '11 00:03

Snake


People also ask

What are the two main components of the rule engine?

The inputs to a rule engine are a rule execution set and some data objects.

What is a rules based engine?

The simple way. What is a rules engine? A rule engine is a software tool that enables developers to model the world in a declarative way. Abstraction is the removal of details in order to enhance the visibility of a pattern.

When should you use a rules engine?

Rules engines are used to execute discrete logic that needs to have 100% precision. Machine learning on the other hand, is focused on taking a number of inputs and trying to predict an outcome. It's important to understand the strengths of both technologies so you can identify the right solution for the problem.


1 Answers

See this post for argument for implementing your own:

Rules Engine - pros and cons

mainly the problem centers around the anemic data model anti-pattern. as described here:

http://martinfowler.com/bliki/AnemicDomainModel.html

How you should implement depends very much on the requirements but generally important points to consider when designing your own include.

  • Make the ability to add rules dynamic. So you don't have to shut down the system to edit rules.
  • Match the rules syntax to the appropriate user level, don't expect a secretary to be writing SQL.
  • Take advantage of your domain knowledge to implement your domain models which you will run your rules against.
  • Drools is a good bit of software, try to learn lessons from how that was implemented.
  • Try to modularize your rules engine so it functions independent of any business process tools you might be using
like image 126
rogermushroom Avatar answered Nov 11 '22 13:11

rogermushroom