Rules Engine

Sustaining changing business environment and remaining competitive is one of the biggest challenges faced by organizations today. Changes in competitive factors ultimately result in changes in business rules. Frequent changes to business rules increase the cost of maintenance, enhancement and customization: a problem seen across verticals. This calls for flexibility in administration and maintenance of applications and real-time responsiveness to changes in business requirements.

  • Definition: The well-known Business Rules Group published two definitions for business rules.
    1. Business perspective: A business rule is ‘a directive, intended to influence or guide business behavior, in support of business policy that has been formulated in response to an opportunity, threat, strength, or weakness’.
    2. IT perspective: A business rule is ‘a statement that defines or constrains an aspect of the business. It is intended to assert business structure, or to control or influence the behavior of the business’.
  • What are Business Rules?
    A statement that defines or constrains some aspect of the business which is intended to assert business structure or to control or influence the behavior or the business.
  • Why use a Business Rule Engine?
    1. Separation of business rules from the applications that use them allows non-programmers to maintain business logic without modifying software.
    2. Reduces development time and significantly reduces maintenance and enhancement cost. Studies show that 15 to 50% of a typical annual IT budget is spent on making, testing, and implementing rule changes in applications.
    3. Increases flexibility and reduces time-to-market.
    4. Promotes visibility and understanding of business policies and procedures.
    5. Promotes consistent decision making.
    6. Forces order to the rules and policies that govern business.
  • Categories of Business Rule: A statement of a business rule falls into one of four categories
    1. Definitions of business terms The most basic element of a business rule is the language used to express it. The very definition of a term is itself a business rule that describes how people think and talk about things. Thus, defining a term is establishing a category of business rule. Terms have traditionally been documented in glossaries or as entities in a conceptual model.
    2. Facts relating terms to each other The nature or operating structure of an organization can be described in terms of the facts that relate terms to each other. To say that a customer can place an order is a business rule. Facts can be documented as natural language sentences or as relationships, attributes, and generalization structures in a graphical model
    3. Constraints or Action assertions Every enterprise constrains behavior in some way, and this is closely related to constraints on what data may or may not be updated. To prevent a record from being made is, in many cases, to prevent an action from taking place.
    4. Derivations Business rules (including laws of nature) define how knowledge in one form may be transformed into other knowledge, possibly in a different form.
  • Examples: The definition of a business rule applies to many statements used in a company. Giving examples of business rules can therefore result in a long list.
    1. A typical example of a business rules from legislation. All states except Montana, an employer can fire any worker for any reason, or for no reason, as long as it is not for an illegal reason.
    2. A typical example of a sales / marketing rule that may be implemented in an IT system. Every visitor of the conference gets a 20% discount on the first product purchase.
    3. A typical example of a rule that will never be implemented in an IT system but probably be stated as a reminder by entering a building Nobody is allowed to smoke inside the company building.
  • Workflow vs Rules Engine
    Wokflow Rules Engine
    Workflow is concerned with the application-specific sequencing of activities via predefined instruction sets, involving either or both automated procedures (software-based) and manual activities (people work). BPM (Business Process Management) is concerned with the definition, execution and management of business processes defined independently of any single application. BPM is a superset of workflow, further differentiated by the ability to coordinate activities across multiple applications with fine grain control.
    Integration between workflow systems and externalities are comparatively limited, often only allowing the retrieval of documents or data variables and only as a pass-through with no awareness of content. BPM systems allow both the capture and introspection of external documents and data, presenting a closed-loop process for validating the integrity of transactions, data and content, as well as the initiation of compensating activities when necessary. BPM processes separate execution instructions from process flows; thus, routing can be tied to process outcomes and milestones.
  • Advantages of a rule engine
    1. Rule englines allow you to say “What to do” not “How to do it”.
    2. Rule systems are capable of solving very very hard problems, yet providing a solution that is able to explain why a “decision” was made (not so easy with other types of AI systems like neural networks, or say, my brain – I have no idea why I scratched the side of the car).
    3. Logic and Data Separation Your data is in your domain objects, the logic is in the rules. This is fundamentally breaking the OO coupling of data and logic (this can be an advantage as well as a disadvantage depending on your point of view). The upshot is that the logic can be much easier to maintain as there are changes in the future, as the logic is all layed out in rules.
    4. Speed and Scalability The Rete algorithm, Leaps algorithm, and its descendents such as Drools’ Reteoo (and Leaps), provide very efficient ways of matching rule patterns to your domain object data. These are especially efficient when you have datasets that do not change entirely (as the rule engine can remember past matches). These algorithms are battle proven.
  • When should you use a rule engine
    It is a complex problem to solve, there are no obvious traditional solutions or basically the problem isn’t fully understood
    The logic changes often
  • When not to use a rule engine
    It seems to me that in the excitement of working with rules engines, that people forget that a rules engine is only one piece of a complex application or solution. Rules engines are not really intended to handle workflow or process executions nor are workflow engines or process management tools designed to do rules. Use the right tool for the job. Sure, a pair of pliers can be used as a hammering tool in a pinch, but that’s not what it’s designed for.

Sustaining changing business environment and remaining competitive is one of the biggest challenges faced by organizations today. Changes in competitive factors ultimately result in changes in business rules. Frequent changes to business rules increase the cost of maintenance, enhancement and customization: a problem seen across verticals. This calls for flexibility in administration and maintenance of…

Leave a Reply

Your email address will not be published. Required fields are marked *