Eight Steps to Crafting a Business Rule — Step 7: Add the Condition(s) ("If ...")
In the previous articles in this series, we constructed the core of our business rule statement by building a simple sentence (subject + verb + object) using a concept model as our guide. Now we want to add the conditions under which the business rule applies.
Not all business rules have an 'if' clause (e.g., "A vehicle must have a model year."), but a significant number do. An 'if' clause lists one or more conditions that must be met for the rule to apply.
The clearer the conditions, the easier it is to understand and validate the rule. Expressing conditions clearly becomes especially challenging when there are multiple conditions linked by ANDs and ORs.
The RuleSpeak® guidelines recommend creating a bulleted list of the conditions preceded by a standard phrase. The most common standard phrases are:
- "if all the following are true:"
- "if any of the following are true:"
- "if one of the following is true:".
Each standard phrase always includes the keyword 'the following' because a list of bulleted conditions literally always follows it.
A bulleted list is far easier to read than a complicated paragraph. It is also easier to validate — for example, conditions that might be missing are much easier to detect.
Experience has shown that using this approach is preferable to using ANDs and ORs, which are less precise and can be misinterpreted.
Here are some examples of rules with conditions:
- A customer must be considered a preferred customer if any of the following are true:
- the customer has stayed in a participating hotel for more than 7 nights within the last 6 months;
- the customer has had more than 5 stays in one or more participating hotels in the last 3 months.
- An employee may be considered eligible for a bonus only if all the following are true:
- the employee has been employed for at least 3 years;
- the employee has been rated as "exceeding expectations" on their performance review;
- the performance review was conducted within the last 6 months.
Note that each of the conditions is a sentence on its own. This helps increase readability and comprehension. And, of course, the terms used in the conditions should follow the vocabulary in the concept model. (I hope you can see how helpful the concept model is — it's always worth the effort it takes to create it!)
One of the mistakes I made when I first started writing business rules was to try to jam as much information as possible close to the subject in the first part of the sentence. For example: "A driver residing in the state of Georgia who has a valid driver's license and is over 75 years of age must pass an annual eye exam."
Note how long it takes to get the rule keyword 'must'. All those phrases qualifying the subject obscure the true intent of the rule. You tend to lose track of what you're trying to constrain.
Instead, you should move all that qualification to the end of the rule statement and allow the true intent of the rule to really stand out. Rewriting the rule above, you get:
- A driver must pass an eye exam if all the following are true:
- the driver resides in the state of Georgia;
- the driver is over 75 years of age;
- the driver has a valid driver's license;
- the driver has not passed an eye exam for more than 12 months.
Now the intent of the rule, "A driver must pass an eye exam …." becomes crystal clear.
Ordering the Conditions
Logically it does not matter in what order bulleted conditions are listed. However, it is sometimes helpful to follow some sort of sequential order that makes the most sense to the business.
Sometimes you discover multiple rules that follow a similar pattern — for example, rules that have:
- the same or similar basic idea (subject + verb + object), and
- similar lists of bulleted conditions.
In insurance, for example, you might see rules of a similar pattern to determine eligibility for different coverages. In that case, you might want to list similar conditions in the same order. This approach improves overall readability. It also makes it much easier to identify discrepancies and possible omissions within the various bulleted lists.
Following the guidelines described in this series of articles results in business rules that are easily understood and maintained. Although different Business Analysts might still write the same rule differently, following the steps presented in this series dramatically improves overall consistency.
Next month I'll discuss what you do once you have completed writing your set of business rules. Hint: It's called verification.
Building Business Solutions: Business Analysis with Business Rules, by Ronald G. Ross with Gladys S.W. Lam, An IIBA® Sponsored Handbook, Business Rule Solutions, LLC, October 2011, 304 pp. URL: http://www.brsolutions.com/bbs
For more information on the RuleSpeak® technique, visit www.RuleSpeak.com
Articles on Concept Models:
Ronald G. Ross, "Concept Model vs. Fact Model vs. Conceptual Data Model — Just a Matter of Semantics?" Business Rules Journal, Vol. 13, No. 1 (Jan. 2012), URL: http://www.BRCommunity.com/a2012/b632.html
Ronald G. Ross, "What Are Fact Models and Why Do You Need Them? (Part 1)," Business Rules Journal, Vol. 1, No. 5 (May 2000), URL: http://www.BRCommunity.com/a2000/b008a.html
Ronald G. Ross, "What Are Fact Models and Why Do You Need Them? (Part 2)," Business Rules Journal, Vol. 1, No. 7 (July 2000), URL: http://www.BRCommunity.com/a2000/b008b.html
# # #
About our Contributor:
February 6-8, 2018
April 17-19, 2018