流程引擎规则引擎
Following are some of the major advantages of a Rule Engine:
以下是规则引擎的一些主要优点:
更容易理解 (Easier to understand)
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或其他命令式语言编写的程序更容易理解。
改善的可维护性 (Improved maintainability)
Since rules are easier to understand, a developer can spend more time solving the actual problem.
由于规则更容易理解,因此开发人员可以花费更多时间来解决实际问题。
应对不断变化的复杂性 (Dealing with evolving complexity)
It is much easier to add new, modify, or remove existing rules than to change, for example, a Java
program. The impact this has on other rules is minimal in comparison with an imperative-style implementation.
添加新的,修改或删除现有规则要比更改(例如Java
程序)容易得多。 与命令式实现相比,这对其他规则的影响是最小的。
灵活性: (Flexibility:)
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 Java
program.
它可以更好地处理对需求的更改或对数据模型的更改。 更改或重写应用程序绝非易事。 但是,由于规则带来的形式主义,更改规则比更改Java
程序容易得多。
合理的表现 (Reasonable performance)
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背后的Rete算法 ; 从理论上讲,系统的性能不取决于规则的数量。 在Drools的每个发行版中,通过添加各种优化(例如Rete节点共享 , 节点索引 , 并行执行等) ,引擎的性能都会得到改善。 所有这些都有益于新旧规则。
将需求转化为规则 (Translating requirements into rules)
The representation of business rules is consistent. For example, let's take some business rule and implement it in Java
. 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.
业务规则的表示是一致的。 例如,让我们采用一些业务规则,并在Java
实现它。 开发人员根据他们的经验,倾向于使用不同的方法来解决问题。 我们将发现可能的解决方案将有很大的不同。 鉴于规则,这种多样化变得不那么明显。 仅仅是因为我们表达的是“什么”而不是“如何” 。 结果,即使是新开发人员,代码也更容易阅读。
能够将企业管理应用于我们的规则 (Ability to apply enterprise management to our rules)
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)
这建立在一致表示的先前优势之上。 如果我们具有一致的表示形式,那么引入适用于我们所有规则的新功能(例如审计 , 日志记录 , 报告或性能优化 )会容易得多。
可重用性: (Reusability:)
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.
规则保存在一个地方(将业务逻辑与系统的其余部分分开),这意味着更易于重用。 例如,假设您已经为应用程序编写了一些验证规则,然后需要进行一些批处理数据导入,那么您可以简单地在批处理导入应用程序中重用验证规则。
紧密建模应用程序 (Modeling the application closely)
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.
规则更紧密地模拟了应用程序不变式。 命令式解决方案倾向于根据所选择的算法对操作施加任意且通常不必要的排序。 然后,这将隐藏应用程序的原始不变式。
统一 (Unifying)
The Drools platform brings unification of rules and processes. It is easy to call rules from a process or vice versa.
Drools平台带来了规则和流程的统一。 从流程中调用规则很容易,反之亦然。
重新部署 (Redeploying)
It is possible to change/redeploy rules and processes without even stopping the whole application.
甚至可以在不停止整个应用程序的情况下更改/重新部署规则和流程。
翻译自: https://www.studytonight.com/drools/advantage-rule-engine
流程引擎规则引擎