What’s Wrong with Using “OR” in Business Rules?
Last week, a friend of mine pinged me about my opinion on using “OR” in business rules. While there are cases where I use them, there are many pitfalls that business analysts and rules writers should be aware of.
Business rules are statements that prescribe a set of actions when certain conditions are met. They direct decision-making and processes in day-to-day operations. As more operations become automated, the more important business rules become. For example, let’s say you’re a retailer of handmade soaps and candles and you would like to broaden your reach through e-commerce. You set up an online store and would like to offer free standard shipping to customers who place an order of $75 or more. A business rule that executes in the background may be the following:
IF order amount is greater or equal to $75
AND the shipping mode is “standard”
THEN shipping amount is $0
But what if you would also like to offer free standard shipping to your VIP customers? You may be tempted to combine these conditions into one rule:
IF order amount is greater or equal to $75
OR customer status is VIP
AND the shipping mode is “standard”
THEN shipping amount is $0
However, according to rule design best practices, you should avoid mixing different conditions that lead to the same actions. Instead, implement the different conditions as separate rules:
Rule 1: IF order amount is greater or equal to $75 AND the shipping mode is “standard” THEN shipping amount is $0
Rule 2: IF customer status is VIP AND the shipping mode is “standard” THEN shipping amount is $0
In this post, I discuss why you should avoid OR.
Rete Doesn’t Support “OR”
Many of today’s rules engines evaluate and execute rules through a derivative of the Rete algorithm. While Rete and similar inference engines are very powerful at assessing large volumes of business rules with multiple dependencies, Rete doesn’t natively support “OR.” Business rules management systems or decision management platforms that rely on Rete accommodate “OR” by replicating the logic for each condition. So, in my example above, if you happen to combine the conditions (2nd ruleset), the business rules management system will automatically convert your logic into 2 separate rules (3rd ruleset). With simple rules, this is not a big deal. However, when rules writers go overboard with “OR”, they will negatively impact performance.
For example, consider a rule that goes something like this:
IF (Condition A1 OR Condition A2 OR Condition A3 OR Condition A4 OR Condition A5)
OR (Condition B1 OR Condition B2 OR Condition B3 OR Condition B4 OR Condition B5)
OR (Condition C1 OR Condition C2 OR Condition C3 OR Condition C4 OR Condition C5)
OR (Condition D1 OR Condition D2 OR Condition D3 OR Condition D4 OR Condition D5)
OR (Condition E1 OR Condition E2 OR Condition E3 OR Condition E4 OR Condition E5)
…
THEN Action
This single rule will be converted to hundreds of rules and nodes in the Rete network. More nodes means more memory usage and leads to longer execution time. In a nutshell, the advantages of using the Rete algorithm goes away with extensive “OR” usage.
“OR” is Inflexible
Even if your rules engine doesn’t use Rete, “OR” should be avoided because it’s less flexible in two ways. By combining multiple conditions…
- “OR” makes the logic less readable/understandable
- “OR” makes the logic more difficult to update when the different conditions evolve differently
Let’s go back to the e-commerce example.
IF order amount is greater or equal to $75
OR customer status is VIP
AND the shipping mode is “standard”
THEN shipping amount is $0
The above could be interpreted in one of two ways:
Interpretation 1: IF (order amount is greater or equal to $75 OR customer status is VIP) AND the shipping mode is “standard” THEN shipping amount is $0.
Interpretation 2: IF order amount is greater or equal to $75 OR (customer status is VIP AND the shipping mode is “standard”) THEN shipping amount is $0.
Let’s say your rules engine defaults to the first interpretation (which is the correct one). But then a few years later, you migrate to a different rules engine which either defaults to the second interpretation or fails to understand the rule altogether until you specify the order. Modifying one rule may be easy but imaging having to modify hundreds or thousands or rules. Not only would this be cumbersome, you would increase the risk of missing some and executing faulty logic. Under the second interpretation, you would be offering free standard, 2-day, and overnight shipping to customers who spend $75 or more. That simple error could lead to much lost revenue.
Now let’s say, after a couple years, your marketing department wants to improve the perks for your VIP customers. Instead of receiving free standard shipping, VIP customers get free 2-day shipping. If your rules combine the conditions (2nd ruleset), you will need to completely rewrite the rules. However, if you separated the conditions (3rd ruleset), you would simply need to update your 2nd rule:
Rule 1: IF order amount is greater or equal to $75 AND the shipping mode is “standard” THEN shipping amount is $0
Rule 2: IF customer status is VIP AND the shipping mode is “2-day” THEN shipping amount is $0
Use “IN” instead of “OR”
In addition to writing separate rules for separate conditions, you can leverage “IN” when you’re dealing with lists or membership. For example, financial institutions (FIs) have to abide by both federal and state regulations. As a result, FIs may have different rules for different states. A certain product, for example, may only be available in a few states. Rather than writing “IF applicant state is CA or NY or VA THEN …,” express the rule as “”IF applicant state is IN CA, NY, VA THEN …” Using “IN” will improve runtime performance and is much easier for humans to read and understand.
Why Don’t We Get Rid of “OR”?
Despite its pitfalls, there are actually some cases where it makes sense to use “OR” in business rules. For example, “OR” makes sense when you need to define a group but that characteristics of that group are based on unrelated attributes. Let’s say you need to indicate whether a customer, member, or employee is considered a minority. According to your company policies, minorities include women, non-whites, people over 65, and those with disabilities. You could write the following rule:
IF sex is female
OR race is IN African-American, Asian-American, Hispanic-American, Native-American)
OR age is greater or equal to 65
OR disability is true
THEN minority is true
In general, when you need to define a business term such as “minority,” you can use “OR.” I recommend capturing the business terms first and then reference them in subsequent business rules. Here is a screenshot of the data pane in our SMARTS™ decision management platform. The business term “Minority” has been created. The business rules above reference that term and will populate that field.

Now Minority can be used along with First Name, Last Name, Age, and other fields in other business rules. This approach allows you to limit your usage of “OR” to the initial population of the Minority field.
In addition, I recommend taking advantage of SMARTS™ Fluid Metaphors to maintain any decision logic that uses “OR.” Rather than reviewing logic as syntax, you can switch the logic to decision graphs or tables to help you better understand the relationships between the conditions and actions. I cover more rules writing pitfalls here and other tips on how to write business rules here.
Learn more about Decision management and Sparkling Logic’s SMARTS™ Data-Powered Decision Manager

