何时使用业务规则引擎
何时使用业务规则引擎?
业务规则引擎和脚本/配置/定制之间有什么区别
When is a Business Rules Engine used?
What is the difference between Business Rules Engines and scripting/configuration/customization
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您尝试在代码中实现决策时,应使用业务规则引擎或业务规则管理系统。 但不仅仅是任何决定。 一项决策:
这些是使用业务规则管理系统带来回报的决策类型。 不要从规则开始,而是从决策开始。
业务规则是冗长的(因此业务人员发现它们更容易阅读)、声明性而非过程性和原子性(因此它们可以像数据库中的数据一样被存储、管理和重用)。
有关为什么使用业务规则的更多信息,请参阅本文 我相信商业规则。
A business rules engine, or a business rules management system, should be used when you are trying to implement a decision in your code. But not just any decision. A decision that:
These are the kinds of decisions that pay off the use of a business rules management system. Don't start with the rules, start with the DECISIONS.
Business rules are verbose (so business people find them easier to read), declarative not procedural and atomic (so they can be stored, managed and reused like data in a database).
More on why to use business rules here in this piece on why I believe in business rules.
业务规则引擎通常用于向应用程序提供可定制的“IF some-condition-THEN do-something”类型的逻辑。 这些类型的业务规则可以触发某些工作流程来执行或将事件知识冒泡到更高级别的规则,从而对它们进行评估。
使用规则引擎还可以通过从代码中删除业务逻辑来更轻松地分离关注点。 如今的规则引擎通常还提供一个前端,用户可以在其中添加新规则,而无需修改应用程序内的脚本。
规则引擎实现了 Rete(根据 Drools 的经验)等算法,可以更快地完成评估规则的任务。 规则引擎还提供规则的前向链接、后向链接、混合链接等。 然而,这些也可以用脚本语言来实现。 您可以使用这两种方法实现一些相同的事情,但我相信这取决于您应该选择哪种途径的规则的复杂性和数量。
看一下 Jess 项目中的链接:http://www.jessrules.com/guidelines.shtml< /a>
它提供了一个逐步演练的问题来询问自己,以确定规则引擎是否满足您的需求,或者是否过度。
Business rules engines are typically used to provide customizable "IF some-condidtion THEN do-something" sorts of logic to applications. These types of business rules can trigger certain workflows to execute or bubble up event knowledge to higher level rules, causing them to be evaluated.
Using a rule engine also allows for easier separation of concerns by removing the business logic from your code. Rules engines today typically also offer a front-end where users can add new rules without having to modify scripts inside the application.
Rules engines implement algorithms such as Rete (speaking from Drools experience) that make the task of evaluating the rules quicker. The rule engine also provides forward chaining, backward chaining, hybrid chaining, etc. of rules. However, these could be implemented in a scripting language as well. You can achieve some of the same sorts of things with both approaches, but I believe that it depends on the complexity and number of rules as to which avenue you should choose.
Take a look at this link from the Jess project: http://www.jessrules.com/guidelines.shtml
It provides a step-by-step walk through of questions to ask yourself in order to determine if a rules engine meets your needs, or is overkill.
规则引擎可以进行前向和后向链接以及推理。 查看 Fair Isaac Blaze、Drools 或 iLog 的实现。
Rules engines can do forward and backward chaining as well as inferencing. Check out Fair Isaac Blaze, Drools or iLog for implementations.