流程引擎规则引擎
Following are some of the major advantages of a Rule Engine:
以下是规则引擎的一些主要优点:
Rules are easier to understand for a business analyst or a new developer than a program written in Java or other imperative-style language.
对于业务分析师或新开发人员而言,规则比用Java或其他命令式语言编写的程序更容易理解。
Since rules are easier to understand, a developer can spend more time solving the actual problem.
由于规则更容易理解,因此开发人员可以花费更多时间来解决实际问题。
It is much easier to add new, modify, or remove existing rules than to change, for example, a program. The impact this has on other rules is minimal in comparison with an imperative-style implementation.
添加新的,修改或删除现有规则要比更改(例如程序)容易得多。 与命令式实现相比,这对其他规则的影响是最小的。
It deals better with changes to the requirements or changes to the data model. Changing or rewriting an application is never an easy task. However, thanks to the formalism that rules bring, it is much easier to change rules than to change a program.
它可以更好地处理对需求的更改或对数据模型的更改。 或应用程序绝非易事。 但是,由于规则带来的形式主义,更改规则比更改程序容易得多。
Thanks to the Rete algorithm that is behind Drools; in theory, the performance of the system doesn't depend on the number of rules. With every release of Drools, the performance of the engine is getting better by adding various optimizations such as Rete node sharing, node indexing, parallel execution, and so on. All this benefits new as well as old rules.
多亏了Drools背后的 ; 从理论上讲,系统的性能不取决于规则的数量。 在Drools的每个发行版中,通过添加各种优化(例如 , , ,引擎的性能都会得到改善。 所有这些都有益于新旧规则。
The representation of business rules is consistent. For example, let's take some business rule and implement it in . Developers, depending on their experience, tend to use different ways to solve a problem. We'll find out that the possible solutions will vary greatly. Whereas with rules, this diversification becomes less apparent. It is simply because we are expressing "what" instead of "how". As a result the code is much easier to read even by new developers.
业务规则的表示是一致的。 例如,让我们采用一些业务规则,并在实现它。 开发人员根据他们的经验,倾向于使用不同的方法来解决问题。 我们将发现可能的解决方案将有很大的不同。 鉴于规则,这种多样化变得不那么明显。 仅仅是因为我们表达的是而不是 。 结果,即使是新开发人员,代码也更容易阅读。
This builds on the previous advantage of consistent representation. If we have consistent representation, it is much easier to introduce new features that apply across all our rules (for example, auditing, logging, reporting, or performance optimizations)
这建立在一致表示的先前优势之上。 如果我们具有一致的表示形式,那么引入适用于我们所有规则的新功能(例如 , , 或 )会容易得多。
The rules are kept in one place (separation of business logic from the rest of the system), which means easier reusability. For example, imagine you've written some validation rules for your application and later on there is a need to do some batch imports of data, so you could simply reuse the validation rules in your batch import application.
规则保存在一个地方(将业务逻辑与系统的其余部分分开),这意味着更易于重用。 例如,假设您已经为应用程序编写了一些验证规则,然后需要进行一些批处理数据导入,那么您可以简单地在批处理导入应用程序中重用验证规则。
Rules model the application invariants more closely. The imperative-style solutions tend to impose arbitrary and often unnecessary ordering on operations, depending on the algorithm chosen. This then hides the original invariants of the application.
规则更紧密地模拟了应用程序不变式。 命令式解决方案倾向于根据所选择的算法对操作施加任意且通常不必要的排序。 然后,这将隐藏应用程序的原始不变式。
The Drools platform brings unification of rules and processes. It is easy to call rules from a process or vice versa.
Drools平台带来了规则和流程的统一。 从流程中调用规则很容易,反之亦然。
It is possible to change/redeploy rules and processes without even stopping the whole application.
甚至可以在不停止整个应用程序的情况下更改/重新部署规则和流程。
翻译自: https://www.studytonight.com/drools/advantage-rule-engine