• SRE(Simple Rule Engine) Document


    What is a rule engine?
    什么是规则引擎?
    A Rule Engine is a software system that contains rules on behalf of another system. Many different kinds of rules can be contained in a rules engine: business, legal, company policy, navigation, computational. An example, a website that prompts the user to fill out a form that has dependencies between pages could use a rule engine to control the verification of the validity of the form and the navigition between pages. Another example, a bank could have a set of rules that dictate the interest rate and fee's associated with a checking account. It also provides a means to classify and manage rules in a centralized location instead of being hardcoded throughout an application.

     

    Why use a rule engine?
    为什么使用规则引擎?
    Most companies business strategies are constantly in flux due to their changing internal and external environments; the CEO has a new idea on increasing sales, consumer base is being eroded by a more aggressive competition, current business practices wiill soon be out of compliance due to changes in regulations. How do handle changes in a system in an maintainable, reusable, extensibility, and ownership?
    由于内部外部的环境地变化,大多数公司的商业经营策略会经常持续地变动。CEO 有一个新的想法,增加销售量,顾客 以减少竞争对手的不断侵蚀。当今商业仍没有脱离依赖,正是由于变化的规则。怎么把握系统的变化,做到可维持,可重用,可扩展,和所有权等?

    Maintainability is increased by using a rule engine by centralizing the rules. Typically a non-rule engine based systems that contain rules of moderate complexity will implement its rules in methods of objects that encapsulate business logic (business objects). They refer to other business objects that form associations with other business objects, typically creating an intricate web of associations. Since these objects are tightly coupled changes to them can have rippling effects throughout the collection. Clarity of the rules in such a system can be quite poor when the rules cross these objects. Not only is it difficult for a developer to understand the details of such relationships, but even more so to change them.
    规则引擎通过集中规则来增强系统的可维护性。对于不基于规则引擎的含有规则的系统,典型的简化复杂性的处理方法是将它的规则插入业务逻辑对象的方法中。这 些业务逻辑对象涉及到其他业务逻辑对象,尤其是形成的错综复杂的关系网。那些对象紧紧地联系的变化会透过对象集成产生联动效果。清晰的规则贯穿于这些对象 实体中,这样系统就变得相当的不健壮。对于开发人员仅仅理解这些关系的详细内容就是困难的,更甚至是要改变这些关系。

    Typically a rule engine based system will use a proxy class that delegates a call to a rule engine.
    基于规则引擎的系统典型的方法就是使用一个代理类通过委托调用规则引擎。

    Ownership of rules can be shifted to business units with a rule engine, especially with SRE. Rules being declarity in nature are easy to understand.  SRE was designed around its rules being contained in a simple to understand XML file, hence the word SIMPLE in SRE. XML should take no more than a day to learn; they even have XML for dummies and XML in 24hours books.
    系统自有的规则都转移到集中的规则引擎中,尤其使用SRE。规则使用容易理解的自然语言描述。SRE设计将规则放置在简单易于理解的XML文档中。XML很容易学习,可以不超过一天时间,就有一些 XML in 24hours 等书籍
     

    What is SRE (Simple Rule Engine)?
    什么是SRE(Simple Rule Engine)?
    From a technical perspective, SRE is a comprehensive, flexible product aimed at enabling software developers to create applications that can be mainteained with minimal effort and directly supported by designated business users. It leverates the flexibility and robustness of XML into a context that business users can understand and own freeing developers to work on new functionality.  It allows developers to combine rule-based and object oriented programmng methods to add business rules to new and existing applications.  Hence the name of this product, Simple Rule Engine.

     

    How does SRE simplify our development?
    怎么让SRE简化我们的开发过程?
    1. SRE makes it easy to create, edit, store, and organize rules.
    2. SRE's XML is the simpliest possible manner of describing rules.
    3. Rules are declaritive, not procedural, in nature allowing problems to be broken down into discrete pieces.
    4. SRE allows rules to be seperated from your application allowing for flexibility for future changes.

     

    Why would I want to use SRE instead of a full blown rule engine?
    为什么我要使用它而不是一个完整的规则引擎?
    A full blown rule engine, like NxBRE (also open source), is far more capable than SRE but it comes at a price. That ability has a price, SRE has far better performance and is far easier to understand. Not every application needs the complexity of a bull blown rule engine, sometimes a simple one will do just fine and sometimes it wont. Choose wisely.

     

    What kind of rule engines are there?
    规则引擎都有什么样的类型呢?
    Chaining refers to the relationship between the rules; forward and backwards refer to the direction of that relationship.

    Forward chaining : Often refered to being 'data driven' due to the fact that the data determines the truthality of the rule.
    (Rule) If my car is green, then
    (Action) my house red.
    (Fact) I have a green car.
    (therefore) I have a red house.

    Backwards-chaining : Often refered to being 'goal driven' due to the fact that we are trying to determine if something exists based on existing information.
    (Rule) If my car is green, then
    (Action) my house red.
    (Fact) My house is NOT red.
    (therefore) I dont have a green car.

    hybrid :  combination of the above two.

     

    What is contained in a rule engine?
    一个规则引擎都包含哪些内容?
    Rule engines typically support rules, facts, priority (score), mutual exclusion, preconditions, and other functions. Because SRE's goal is to be simple and not a full blown rule engine, it only supports rules, facts, and actions.

     

    What kind of rule engine is SRE?
    SRE属于哪一类规则引擎?
    forward chaining

     

    What is declararitive programming?
    (modified version from drool)
    Declarative programming deals with what is, as opposed with the how to normally encountered in imperative programming languages. SRE allows for rules to be decoupled and lowers the unidirectional logical flow. Declarative rules typically take the form as follows:

    http://sourceforge.net/docman/display_doc.php?docid=30688&group_id=139180
  • 相关阅读:
    C++优化和计算速度(碎碎念)
    架设一个p2p存储网络的问题(讨论)
    JAVA做敏感词统计——DFA 算法
    卸载Postman,用IntelliJ IDEA发起http请求
    LPC1788SDRAM调试
    ASP.NET网站大附件上传配置
    K2 Blackpearl中从数据库直接删除流程实例之K2Server表
    K2流程实例出错,切换到其他版本运行
    使用K2时提示未能加载文件或程序集Microsoft.IdentityModel等
    K2 Blackpearl中从数据库直接删除流程实例之K2ServerLog表
  • 原文地址:https://www.cnblogs.com/august/p/1252154.html
Copyright © 2020-2023  润新知