Skip to content

Clarification on terminology and rule conditions #11

@joyrexus

Description

@joyrexus

Wondering about the distinction between a Rule and a Condition .. and whether there's really any need to have these two distinct types?

Let me explain.

So, RulePilot distinguishes between the following things ...

  • Rule - a collection of conditions (with an optional default result)
  • Condition - a boolean operator (any|all|none) operating on one or more conditions or constraints (with optional result)
  • Constraint - a data test expression checking if operator(field, value) is true or false

A rule can have one or more "conditions":

// a single condition rule
const rule1: Rule = {
  conditions: { ... },
};

// another single condition rule
const rule2: Rule = {
  conditions: [{ ... }],
};

// a rule with two conditions
const rule3: Rule = {
  conditions: [{ ... }, { ... }],
};

// a rule with two conditions and a default result
const rule4: Rule = {
  conditions: [{ ... }, { ... }],
  default: "DEFAULT",
};

What's not immediately clear is why you need to distinguish between a Rule and a Condition at all.

A rule with two conditions seems equivalent to an any condition with the same two original conditions in its array.

Can you clarify what motivated the distinction?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions