Search ::     [ Advanced ]
Username:   Password: Auto login next time?  

AttainingEdge : World Class Training For Critical Business Innovations

Corticon RulesWorld

RuleXpress: The business tool for expressing and communication business rules.

 

 

 

 

     ROSS ARCHIVES ...
untitled

What's Wrong with If-Then Syntax For Expressing Business Rules
One Size Doesn't Fit All

by Ronald G. Ross

A central idea of the business rule approach is that business rules should be expressed with business people in natural language.  That seems self-evident.  The Business Rules Manifesto[1] says it this way:  Rules should be expressed declaratively in natural-language sentences for the business audience.  This is the guiding idea behind RuleSpeak[2], which I use for the business examples in this discussion.

Is the difference between business-speak and system-speak for expressing (and managing) business rules really that big?  Yes!  And the gaps are much wider and more fundamental than you might think.  It's no surprise then that business people and IT people often feel the other side is speaking Greek. 

Let's first examine a simple rule expressed from the business side to see why.

Rule:  A student must not register for more than 6 classes in a semester.

A key question is what happens if the rule is violated -- i.e., a student tries to register for a 7th class?

The business needs at least two things -- a response to the violation and an explanation for that response.  The natural defaults of the business rules approach are as follows.

  • Response to the violation.  The 7th registration is disallowed.  In other words, circumstances or events that violate the rule are to be rejected outright.  Isn't that exactly what you would usually expect?!  It almost goes without saying.

  • Explanation for the response.  "A student must not register for more than 6 classes in a semester."  That's basically it!  Stating the rule itself gives the business explanation.  In other words, the statement of the rule is the most basic part of any 'error' or guidance message to be returned to the worker/user (assuming he or she is authorized and capable) upon any violation.

These two fundamental 'defaults' of the business rule approach greatly simplify business requirements as expressed from the business perspective.  That doesn't cover all business requirements, of course -- just the 100's or 1000's most naturally expressed as business rules.  But that's a pretty big deal!

Before focusing directly on the if-then style, we need to dig a little deeper.  To do the issues involved real justice, we need to look at a more complex rule.  From health insurance we might have the following rule.  (On a personal note, I broke my arm several years ago, so this one really hits home!)

Rule:  The amount claimed for a "sling" must be LE the special limit for an incidental if the claimant is out-of-state and the claim amount is LE $500.

This rule is just one out of 1000s of claim rules.  It is a richer example, coming from an organization that is clearly knowledge-intensive.

Again, a key question is what happens if the rule is violated?  The answer is probably 'it depends'.  In other words, both the response to the violation and the explanation for that response may be selective to circumstances.  That's especially true if we consider re-use of the rule cross-functionally.  (Re-use, of course, is always a pretty good idea!  For rules in particular, it produces business consistency.)  From a business perspective, re-use of the rule means the rule is to be applied at different points with the company's business process(es).

For example, the rule might be used both in responding to customer queries (e.g., "Would I be covered if …?") and for validating actual claims.  Clearly, the appropriate response depends on the situation.  For the former, it might be a polite message.  For the latter, the hammer comes down and the claim gets paid or not paid.  Here then is a fuller view of the business rule.

Rule:  The amount claimed for a "sling" must be LE the special limit for an incidental if the claimant is out-of-state and the claim amount is LE $500.

 

Applicability Condition

Response to Violation[3]

1.

The claim is submitted for inquiry only.

Return polite message to the submitter.

2.

The claim is submitted for payment.

Mark the claim non-payable.

This more complete view of the business rule introduces the notion of applicability conditions.  Essentially, applicability conditions represent a certain kind of externalized "if" condition.

Notice that the rule statement remains exactly as it was before.  No changes.  Think of the actual business rule as that part of the business logic that remains constant even if responses to violations vary for different circumstances.

Why is that important?  In a business with 1000s of rules, keeping your eye on the 'constants' is not merely helpful, it's essential.  Otherwise, the number of rules starts to balloon out of control.  That's one of the undesirable consequences that results from the if-then style, to which we now turn.

Clearly, many IT professionals do prefer the if-then style for expressing rules.  Why?  Put simply, it's closer to what they need for implementation, whether under a rule engine or a programming language.  Consequently, they often resist expression of the rules from the business perspective.

What does that do to the rules themselves?  There are two highly undesirable consequences.  One, as above, is that the number of rules balloons.  Second, the business intent of the rules often goes missing.  These effects aren't necessarily obvious when you look at only one rule at a time.  But the problem compounds.  It really hits you hard when you scale up to 100's or 1000's.  At that threshold (or even before) there are simply too many rules to keep straight in your head.

The if-then style of expressing rules generally involves three major departures from business expression.  To illustrate I'll use the 'sling' rule above.  Again, keep in mind that analysis of a single rule can't completely convey the true magnitude of the problem.

1.  Reversed Logic.  Business people express rules focusing on the condition(s) not to be violated.  Common use of the if-then style, in contrast, focuses on the condition(s) causing a violation, forcing you to switch the logic around.  Most rule engines and programming languages today require that switch.  For the 'sling' rule, this means reversing "less than or equal to" (LE) to "greater than" (GT).  Doing a lot of that can give you mental whiplash!

Business Perspective …
The condition not to be violated

The amount claimed must be …
LE the special limit …

IT Developer Perspective …
The condition causing a violation

If the amount claimed is …
GT the special limit …

2.  Different Lead-Off.  Business people naturally tend to express rules focusing on the constraint to be enforced.  That comes first.  Rules expressed in if-then style always start off with "if" -- that is, they always put any and all condition(s) first.  That's because most rule engines and programming languages are looking (step one) to determine whether these condition(s) are satisfied, in order to know (step two) whether to take some action.  Unfortunately, that means in reading the rule you don't get a real sense of where it's headed until you actually get there (and maybe not even then).

Business Perspective …
The constraint comes first

The amount claimed must be
LE the special limit …

IT Developer Perspective …
The condition comes first

If the claimant is out-of-state and the claim amount is LE $500 …

3.  Mandatory response.  Business people often express business rules assuming the default response, disallow violations.  (Let's ignore potential re-use for the moment.)  The if-then style does not have any such default, so some relevant response or action must always be specified.  Otherwise, most rule engines and programming languages simply won't work.  As a consequence, IT developers often have to invent responses, which naturally tend to be system-ish.  Ironically, IT developers often criticize business expression of rules as not being 'sufficiently detailed' because they lack these very responses.  Of course, it's detail without any real business purpose.

Business Perspective …
"Disallow violation" assumed

(Disallow violation)

IT Developer Perspective …
Action taken if the rule is violated

If … then set don't-pay-flag(?)

To summarize the points above, transforming rules expressed in business form into counterparts expressed in if-then style therefore requires (1) reversing the main condition, (2) putting the conditions first, and (3) giving an action even if none was indicated.  Applying these transformations to the "sling" rule, we arrive at the following.

Business Perspective …

The amount claimed for a "sling" must be LE the special limit for an incidental if the claimant is out-of-state and the claim amount is LE $500.

IT Developer Perspective …

If the claimant is out-of-state and the amount claimed for a "sling" is GT the special limit for an incidental and the claim amount is LE $500 then set don't-pay-flag.

What has happened?  In the original rule, the constraint part ("The amount claimed for a "sling" must be LE the special limit for an incidental …") was clear.  In the transformed rule, the constraint part loses its pre-eminent status and becomes just another condition.  Do you see it?  I purposely stuck it in as the second of the three ANDed conditions (with the LE reversed to GT) just to make the following point more forcefully.  In a rule with many conditions (which covers the majority of rules), the true sense of the rule gets lost very easily.

Unfortunately, that's not the end of the bad news for the if-then style.  Let's now factor in re-use of the business rule for different business functions and the selective responses to violations such use might require.  A key point made earlier is that the expression of the business rule should remain the same even if different responses to violations are required at different points.  One rule, multiple responses.

That's not how it works with the if-then style.  Rather, you must create a separate rule for each selective response because the appropriate applicability condition must be ANDed in.  For the 'sling' rule, this results in the following two rules.  By the way, in each case I placed the applicability condition last among the ANDed conditions for the sake of clarity, but nothing (other than perhaps sanity) compelled me to do that.  Are you beginning to see how business intent gets lost so easily using if-then?

 

Applicability Condition

'Sling' Rule in If-Then Style

Rule 1.

The claim is submitted for inquiry only.

If the claimant is out-of-state and the amount claimed for a "sling" is GT the special limit for an incidental and the claim amount is LE $500 and the claim is submitted for inquiry only then display "We're sorry, you wouldn't be covered".

Rule 2.

The claim is submitted for payment.

If the claimant is out-of-state and the amount claimed for a "sling" is GT the special limit for an incidental and the claim amount is LE $500 and the claim is submitted for payment then set don't-pay-flag.

To conclude, let's turn the tables and ask why business people often find the IT-friendly if-then style of rules so hard to follow and validate on any large scale.  First note that in the analysis of the sample rules above, I propagated natural business terminology into the if-then rules, rather than substituting system names for corresponding data fields or equivalent.  That, of course, is an inevitable complication, but a fairly obvious one. 

A deeper reason, illustrated above, is that all conditions are treated equal in the if-then style; that is, no kind of condition has any special standing.  That approach obscures which conditions represent (a) the original constraint part of the rule, and (b) applicability condition(s), if any.  In other words, business intent is quickly obscured.

That problem is aggravated by a second reason -- the ballooning number of rules.  That's harder to illustrate.  However in the one-rule example above, using the if-then style doubled the number of rules. 

Is that a reasonable estimate for a larger scale?  I believe this hidden 'balloon factor' might sometimes be much worse.  In any case, ask yourself whether you would rather analyze and manage 100 rules or 200?  A 1000 or 2000?  10,000 or 20,000?  It's obvious.  The Manifesto puts it quite simply, "'More rules' is not better"(!).

Acks to Gladys S.W.  Lam, Principal, Business Rule Solutions, LLC, who co-developed the ideas presented in this discussion.

References

[1] Business Rules Group, Ronald G. Ross, ed., Business Rules Manifesto ~ The Principles of Rule Independence. 1.2 ed., The Business Rules Group (2003), Updated Jan. 8, 2003.  PDF.  Available at www.BusinessRulesGroup.org, now in ten languages.return to article

[2] Ronald G. Ross, Principles of the Business Rule Approach, Boston, MA:  Addison-Wesley, (2003), ISBN:  0-201-78893-4, Chapters 8-12.return to article

[3] In general, responses to violations can take the form of processes or actions (as in this example), and/or other rules or rule sets.return to article


standard citation for this article:
Ronald G. Ross, "What's Wrong with If-Then Syntax For Expressing Business Rules ~ One Size Doesn't Fit All," Business Rules Journal, Vol. 8, No. 7 (July 2007), URL:  http://www.BRCommunity.com/a2007/b353.html  

 about . . .

 RONALD G. ROSS


Ronald G. Ross is recognized internationally as the "father of business rules." He has Chaired the annual Business Rules Forum since 1997. He was a charter member of the Business Rules Group in the 1980s, and an editor of two landmark BRG papers, The Business Motivation Model and the Business Rules Manifesto. He is active in standards development, with core involvement in SBVR.

Mr. Ross is Executive Editor of BRCommunity.com and its flagship publication, Business Rules Journal. He is author of eight professional books, including Business Rule Concepts (2009), a just released 3rd edition of his popular, easy-to-read 1998 handbook. Mr. Ross speaks frequently at industry events worldwide.

Mr. Ross is Co-Founder and Principal of Business Rule Solutions, LLC and is actively engaged in consulting, training and research. He co-developed RuleSpeak®. Mr. Ross gives highly regarded public seminars in North America through AttainingEdge and in Europe through IRM-UK.

For additional information about Mr. Ross, please visit his personal website at www.RonRoss.info.

March 2010
What Is a Business Rule?

February 2010
CRUD in Business Rules: Accident-Prone Decision Logic

January 2010
The Point of Knowledge

December 2009
When is an Exception Really an Exception? The Business Rule Principles of Accommodation and Wholeness

November 2009
Verb-ish Models for Verbalization: Give Us Back Our Verbs!

October 2009
From Rulebook Management to Business Governance: Where Business Rules Fit

September 2009
What You Need to Know About Rulebook Management

August 2009
When Is a Door Not a Door? ~ Basic Ideas of the Business Rules Paradigm

July 2009
General Rulebook Systems (GRBS): What's the General Idea?

June 2009
Becoming Strategy-Driven: The Policy Charter

May 2009
Product Quality and a Longer-Term View: A 'Simple' Matter of Business Policies

April 2009
RuleSpeak® Sentence Forms: Specifying Natural-Language Business Rules in English

March 2009
The Rulebook: To Play Ball You Need Rules

February 2009
Extreme Business Agility (Part 6): A Manifesto-in-Progress on the Semantic Re-Engineering of Products

January 2009
Extreme Business Agility (Part 5): The Optimal Edge of Business Performance

December 2008
Extreme Business Agility (Part 4): Change Deployment Hell

November 2008
Extreme Business Agility ~ Part 3: Examples of Non-Agile vs. Agile Business Capabilities

October 2008
Extreme Business Agility ~ Part 2: A Semantic Approach to Re-Engineering Your Company's Products

September 2008
Extreme Business Agility — Part 1: A Value Chain for Re-Engineering Your Company’s Products

August 2008
My Son, Business Rule Analyst — Governance and Compliance Through Young Eyes

July 2008
Rules vs. Processes (Again) — Part 2: Now for Events

June 2008
Rules vs. Processes (Again) — Part 1: There’s Simply No Need for Confusion

May 2008
Legacy Modernization, Semantics, and the Knowledge Economy ~ Have You Connected the Dots Yet?!

April 2008
The Emergence of SBVR and the True Meaning of ‘Semantics’: Why You Should Care (a Lot!) ~ Part 2

March 2008
The Emergence of SBVR and the True Meaning of ‘Semantics’: Why You Should Care (a Lot!) ~ Part 1

February 2008
The Phoenix Strategy ~ A Lower-Risk Approach to Rejuvenating Systems and Legacy Modernization

January 2008
'Rules of Record' Why 'System of Record' Isn't Enough

December 2007
The Decision Center: A Center of Excellence for Coordinating Business Rules and Other Process 'Smarts'

November 2007
The Latency of Decisions ~ New Ideas on the ROI of Business Rules

October 2007
Legacy Systems -- Poorly Engineered or Over-Engineered? New Insights about Business Rules and Enterprise Decisioning

September 2007
The Value of Decisions ~ New Ideas on the ROI of Business Rules

August 2007
A Case of Dueling Manifestos? Business Rules and Enterprise Decision Management

July 2007
What's Wrong with If-Then Syntax For Expressing Business Rules ~ One Size Doesn't Fit All

June 2007
Are IT Terms Fundamental to Every Business? Not!

May 2007
Are all Rules Business Rules? Not!

April 2007
Are Software Requirements Rules? Not!

March 2007
Are Integrity Constraints Business Rules? Not!

February 2007
From Rule Management to Business Governance, Part 4: Governance Engineers and the Chief Governance Officer (CGO)

January 2007
From Rule Management to Business Governance, Part 3: Re-Engineering the Governance Process

December 2006
From Rule Management to Business Governance, Part 2: Governance and How it Relates to Business Rules

November 2006
From Rule Management to Business Governance, Part 1: Governance and How it Relates to Business Rules

October 2006
Rules and Processes: Examples Showing How They Relate

September 2006
The Meaning of Things: Definitions, Intensions, Rules, and Extensions

August 2006
Re-Vitalize, Don't Just Re-platform! ~ Three Tests for Whether Your Company 'Gets It' with Respect to Re-Platforming Business IP

July 2006
The Dirty Secrets About Your Company's Business IP That Nobody Wants to Talk About

June 2006
A Personal Insurance Saga ~ The Economics of Business Rules

May 2006
Concepts, Definitions, and Rules: RuleSpeak® Practices

April 2006
The RuleSpeak® Business Rule Notation

March 2006
How Rules and Processes Relate ~ Part 6. Point-of-Knowledge Architecture (POKA)

February 2006
How Rules and Processes Relate ~ Part 5. Scripts -- Rule-Friendly Process Models

January 2006
How Rules and Processes Relate ~ Part 4. Business Processes vs. System Processes

December 2005
How Rules and Processes Relate ~ Part 3. Three Best Practices for Designing Business Processes with Rules

November 2005
How Rules and Processes Relate ~ Part 2. Business Processes

October 2005
How Rules and Processes Relate ~ Part 1. The Challenges

September 2005
Rule Quality ~ The Route to Trustworthy Business Logic

August 2005
Decision Tables, Part 2 ~ The Route to Completeness

July 2005
Decision Tables, Part 1 ~ The Route to Consolidated Business Logic

June 2005
Rule Reduction ~ The Route to Atomic Business Rules

May 2005
Essence Definitions and Business Rules ~ Developing Stable Anchor Points for Operational Knowledge

April 2005
Can You Violate Structural Rules? (part 3) ~ The Difference Between Breaking Rules and 'Breaking' Knowledge

March 2005
Can You Violate Structural Rules? (Part 2) ~ The Difference Between How to Compute and How to Behave

February 2005
Can You Violate Structural Rules? (Part 1) ~ The Difference Between Violations and Bad Decisions

 

Janauary 2005
Business Rules and Knowledge Workers ~ Getting to the 'Point of Knowledge'

 

December 2004
Can a Definition be Violated? ~ Definitions and Business Rules

 

November 2004
Rustling Up Good Definitions ~ There's a Lot Less and a Lot More to It

 

October 2004 

Clarifying Clarifications ~ Universal 'And' to the Rescue

 

September 2004 

Relearning the Basics of Communicating ~ Business Semantics and Business Rules

 

August 2004 

The Light World vs. the Dark World ~ Business Rules for Authorization

 

July 2004 

Best-Fit Decision Points ~ How They Fit into the Business Rule Approach

 

June 2004 

What Rule Independence Means to System Models ~ Less and More than You Think!

 

May 2004 

The Semantics Lexicon ~ Terms For The Business Rules / Smart Process

 

April 2004 

Don't Reinvent Rule Engines!

 

March 2004 

Rules And Compliance Tactics

 

February 2004 

Tracing the Path of Rule Reduction

 

December 2003

Do Rules Decompose To Processes Or Vice Versa?

 

November 2003

Should You Encapsulate Knowledge in Modeling Real-World Things?

 

October 2003

Business Rules, Encapsulation, and Models of the Real World

 

September 2003

Business vs. Environment in Business Models

 

August 2003

Requirement Statement vs. Rule Statement

 

July 2003

Rules as Constraints:  On or By the System Design?

 

June 2003

Rules Reveal Events -- Not Actions

 

May 2003

Actions Are Not Rules (and Vice Versa)

 

April 2003

The Definitions of 'Business Rule' and 'Rule'

 

March 2003

Business Problems Addressed by the Business Rule Approach

 

January 2003

About the Business Rules Manifesto ~ The Business Rule Message in a Nutshell

 

November 2002

Business Rules for the Company's Provisioning Processes ~ There’s a Lot More to Reference Data than Just Data!

 

September 2002

The Terminator -- I'll be Back (with Just the Right Term)

 

July 2002

What Does it Mean to be Business-Driven? (Part 2)

 

May 2002

What Does it Mean to be Business-Driven? (Part 1)

 

March 2002

A Telltale E-mail Trail:  The Case for In-Line Business Rule Analysis

 

January 2002

Managing M x N Vs. M + N, Market-Driven Economies, and Other eCommerce Issues (part 2)

 

November 2001

Managing M x N Vs. M + N, Market-Driven Economies, and Other eCommerce Issues (part 1)

 

September 2001

The BRS Rule Classification Scheme

 

July 2001

Minding Your P's and Q's

 

May 2001

RuleSpeak"! -- Templates And Guidelines For Business Rules

 

March 2001

Business Rules In Business Processes ~ Title Rules For Process And Rules For Product/Service

 

January 2001

What Is Rule Management About?

 

November 2000

Let's Make a Deal: A Killer App for Business Rules

 

September 2000

The Re's Of Business Rules

 

July 2000

What Are Fact Models And Why Do You Need Them? (Part 2)

 

May 2000

What Are Fact Models And Why Do You Need Them? (Part 1)

 

March 2000

What is a 'Business Rule'?

 

January 2000

Current Thoughts On Expressing Business Rules

 

November 1999

The Fin de Siegle Legacy Mindset
 

September 1999

Analysis Paralysis Just May Save Your Life
 

July 1999

If We Had Started Coding Already...
 

May 1999

Your Core Business Processes Need a Rule Engine
 

March 1999

Who or What is a True Business Analyst?
 

January 1999

Four Things Wrong with the Way We Develop Information Systems

 

 

 

 





[ Home ] [ Staff ] [ About BRC Publications ] [ Editorial Feedback ] [ About BRCommunity ]
[ Contributor's Guidelines ] [ Privacy Policy ] [ Technical Support ]