Some of the business rule examples in this chapter have started with the phrase
“It is obligatory that” and then continued with a statement of what is obligatory.
These business rules use the same “It is obligatory that”form. There are six busi- ness rule forms, one of which uses the phrase “It is obligatory that.” We will describe each of the six, giving examples of business rules for each.
Obligation Statements
Many business rules oblige people (or software applications) to ensure that some- thing is true. These truth-ensuring rules areobligation statements. An obligation statement begins with the phrase “It is obligatory that” and then continues with what is demanded.
Earlier we consideredGreenbacks Only, a simple obligation statement.
Greenbacks Only:It is obligatory that each cash payment employ US currency.
As an obligation statement,Greenbacks Onlyimplicitly acknowledges the possi- bility that a customer might attempt to use another currency. For example, a cus- tomer might think he could pay his bill with euros. A server might accept the euros, either as a mistake or in ignorance or as a knowing violation of the rule.
All this is possible, and in practice might happen. But as a company, Mykonos 146 CHAPTER 6 Business Rule Models
mandates that it must not happen. Greenbacks Only says that each Mykonos employee has an obligation as part of his or her job to accept only US dollars for cash payments. Further, each Mykonos employee has an obligation to inform custo- mers of this restriction if there are questions or confusion.
Figure 6.2 shows the structure of a simple obligation statement such as Greenbacks Only. The expression that follows “It is obligatory that” is called the mandatory situation. In Greenbacks Only, the mandatory situation is
“each cash payment employ US currency.” That mandatory situation itself may be either true or false. The mandatory situation is true if a cash payment in a Mykonos restaurant in fact employs US currency, and it is false if a cash payment in a Mykonos restaurant employs euros or yen or sterling. Green- backs Only says nothing about whether the mandatory situation is true or false. Instead,Greenbacks Onlystates that the Mykonos employees have an obligation to make the mandatory situation an actuality.
Greenbacks Only is a simple obligation statement. Let’s consider a more complex variant ofGreenbacks Only.
Greenbacks Only B:It is obligatory that each cash payment employ US cur- rency if the payment amount of the cash payment is at least 20 dollars.
Greenbacks Only Binsists on US currency for larger amounts but says nothing about what should happen for payments of less than $20. Either other rules apply for those smaller payments or a server is free to accept other currencies.
Like Greenbacks Only, Greenbacks Only B implicitly acknowledges the possibility of customers paying with more than $20 in non-US currency as well as the possibility of servers accepting such currency. But Greenbacks Only B indicates that such behavior must not happen.
Figure 6.3 shows the structure of Greenbacks Only B.Figure 6.3 includes an optional condition as well as the mandatory situation. The condition is the scope of when the mandatory situation actually applies—when it is mandatory.
It is obligatory that mandatory situation
FIGURE 6.2 The structure of a simple obligation statement
It is obligatory that mandatory situation if condition
FIGURE 6.3 The structure of an obligation statement
For example, inGreenbacks Only B, the condition is “the payment amount of the cash payment is at least 20 dollars.” If the condition is true—if the cash pay- ment is at least 20 dollars—then the mandatory situation applies. For those pay- ments the employees of Mykonos have the responsibility of ensuring that US currency is used. If the condition is false—if the cash payment is less than 20 dol- lars, nothing is mandated. The Mykonos employees are not obligated to do any- thing, at least nothing to satisfy this rule. The “if” in Greenbacks Only B effectively reduces the concern to just those payments where the condition is true—just those payments that are $20 or larger.
Greenbacks Only Bis not a good business rule because there are situations in which it is not clear whether the rule applies. Suppose a customer pays€15 for a couple of drinks at the bar. Is this payment more than $20? How is a server to know, unless she carries the daily currency conversion rates with her?Green- backs Only Cis a better rule with the same intent.
Greenbacks Only C: It is obligatory that each cash payment employ US cur- rency if the cash payment is applied to a bill and the amount of the bill is at least 20 dollars.
Now a server need only know the amount of the bill to determine whether euros are allowable. Of course, if the payment is accepted, someone will have to make a calculation of whether€15 is a sufficient payment and what the change should be. Other rules apply.
Greenbacks Only BandGreenbacks Only Chave the same mandatory sit- uation: “each cash payment employ US currency.” But the conditions of the two rules are different. The condition ofGreenbacks Only C is “the cash payment is applied to a bill and the amount of the bill is at least 20 dollars.” Where the con- dition is true, the employees of Mykonos have the responsibility of ensuring the mandatory situation—of ensuring that cash payments employ US currency. No obligation results where the condition is false. For example, if the account of a bill is less than $20, it does not matter whether US currency is used. Similarly, a cash payment that is applied to something else (other than the bill) can also be done in a non-US currency. A customer might pay greenbacks for his bill, but leave a tip in Mexican pesos, knowing that the server is leaving the next day for a vacation on the Mayan peninsula. Such an action does not violate the rule because the action falls outside the scope of the condition. The rule is only violated when a cash pay- ment is in non-US currency, it is applied to a bill, and the bill is large enough, at least $20.
Obligation statements are the most common of the business rules. When do you use an obligation statement? An obligation statement is used when you want the business—the employees and perhaps the software applications—to ensure that something is true. You first determine the expression that must be kept true, make it the mandatory situation, and (if necessary) create a condition that cap- tures the scope of when the mandatory situation applies.
148 CHAPTER 6 Business Rule Models
Prohibitive Statements
Some business rules are meant to prevent. These preventative business rules are calledprohibitive statements. We have seen several prohibitive statements in this chapter (e.g.,No Checksa few pages back). Let’s look at a prohibitive statement that is a variant of our obligation statementGreenbacks Only.
No Loonies:It is prohibited that a cash payment employ Canadian currency.
Instead of insisting that cash payments employ US currency,No Loonies insists that such payments do not employ Canadian currency. (Perhaps this rule is for a Mykonos restaurant in Buffalo, New York, in which customers often try to pay their bills in Canadian dollars instead of greenbacks.)
As with its obligation statement counterparts,No Looniesdoes not claim that there are no cash payments that use Canadian currency. Rather No Loonies states that Canadian currency should not be allowed for payments. Employees have a duty to reject cash payments in Canadian currency. Software applications such as payment applications should reject such payments as well.
The structure ofNo Looniesis shown inFigure 6.4.
A prohibitive statement starts with the phrase “It is prohibited that.” After that phrase is thebanned situation, an expression of what must be false. The banned situation of No Loonies is that “a cash payment employ Canadian currency.”
A prohibitive statement says that employees (and perhaps software applications) have a responsibility to prevent the banned situation. Employees can prevent the banned situation ofNo Looniesby rejecting cash payments in Canadian dollars and by advising customers that Canadian dollars are not accepted.
As with obligation statements, prohibitive statements can be more complex thanNo Loonies. Many prohibitive statements make the prohibition conditional on some other expression. ConsiderNo Loonies B.
No Loonies B:It is prohibited that a cash payment employ Canadian currency if the cash payment is applied to a bill and the amount of the bill is at least 20 US dollars.
No Loonies Bprohibits the use of Canadian currency for larger bills—those of more than 20 dollars. The structure ofNo Loonies B is shown inFigure 6.5. It includes a condition in addition to the banned situation. The condition is a scope of the ban, a description of when the ban must apply and when it need not.
It is prohibited that banned situation
FIGURE 6.4 The structure of a simple prohibitive statement
The condition ofNo Loonies Bis “the cash payment is applied to a bill and the amount of the bill is at least 20 dollars.” When the condition is true, the banned situation must be prevented. Employees and applications have a duty to examine the payment of bills of more than $20 to ensure that Canadian dollars are not used for those payments.
When do you write your intended business rule as a prohibitive statement?
You use a prohibitive statement when you want the business—the employees and perhaps the applications—to prevent something. You write the banned situ- ation—an expression that describes what must be prevented. If necessary, you write the condition—an expression of the scope of the ban.
Restricted Permissive Statements
Another business rule form is the restricted permissive statement. A restricted permissive statement specifically allows something but restricts the condition under which it is allowed. Let’s look at an example, a variant of the same cash payment rule.
Euros Allowed:It is permitted that a cash payment employ European Union currency only if the cash payment is applied to a bill and the amount of the bill is at most 100 U.S. dollars.
Two Mykonos restaurants are located close to embassies of EU countries. Many of the customers of those restaurants are foreign service officers and other members of the foreign embassy community. For the convenience of those customers, the two Mykonos restaurants accept euros. Euros Allowedsays that euros can be used for bills that are $100 or less but that larger bills cannot employ euros.
Euros Allowedis violated when a customer attempts to use euros to pay for a large bill, one of more than $100.
The structure of a restricted permissive statement is shown in Figure 6.6.
The restricted permissive statement includes a permitted situation. The
It is permitted that permitted situation only if restriction
FIGURE 6.6 The structure of a restricted permissive statement
It is prohibited that banned situation if condition
FIGURE 6.5 The structure of a prohibitive statement
150 CHAPTER 6 Business Rule Models
permitted situation describes what is allowed. InEuros Allowed, the permitted situation is “a cash payment employ European Union currency.” Mykonos allows the cash payment to employ EU currency. The restricted permissive statement also includes a restriction. The restriction describes the scope of the permis- sion—what must be true for the permission to occur. The permitted situation is only allowed to be true if the restriction is also true. In Euros Allowed, the restriction is “the cash payment is applied to a bill and the amount of the bill is at most 100 dollars.” Mykonos allows a cash payment to employ euros only under the restriction that the cash payment is applied to a bill of $100 or less.
The condition in an obligation statement is optional. You can create an obliga- tion statement that has no condition, and it is still a valid business rule. The con- dition in a prohibitive statement is also optional. But the restriction in a restricted permissive statement is required. Without a restriction, the restricted permission statement does not actually shape any behavior. Consider our example without a restriction: “It is permitted that a payment employ European Union currency”—
euros are OK. But if the rule does not exist, then EU currency is OK anyway.
Without a restriction, the rule does nothing.
What violates a restricted permissive statement? A violation occurs when the permitted situation is true even though the restriction is false. The other combi- nations do not matter. If the restriction is true, it doesn’t matter whether the permitted situation is true or false; no violation occurs. For example, if the amount of the bill is $57, the restriction is true, and it doesn’t matter (to this rule) whether European currency is used or not.Euros Allowedis not violated.
And if the permitted situation is false, no violation occurs. If a cash payment does not use euros, it does not matter whether the bill is for $57 or $570.Euros Allowedremains not violated.
When do you write your business rule as a restricted permissive statement?
You use a restricted permissive statement when you want the business to per- mit something only under certain conditions. You write the permitted situation first. Then you write the restriction—what must be true for the situation to be allowed.
Necessity Statements
We have considered three forms of business rules: obligation statements, prohibi- tive statements, and restricted permissive statements. These forms have different semantics, but they are similar in one respect. They all describe what should be.
An obligation statement describes what a business should try to ensure. A prohib- itive statement describes what a business should try to prevent. And a restrictive permissive statement describes what a business should allow under certain conditions.
But some business rules are not concerned with what should be. Instead they describe what is. Consider the business ruleSingle Payment Network.
Single Payment Network: It is necessary that a credit card is backed by exactly one payment network.
VISA is a payment network, as is MasterCard and American Express. Being backed by a single payment network is fundamental to the meaning of a credit card. That is exactly what a credit card does; it provides access to a payment network. Each card is back by exactly one payment network. Capital One may issue both VISA cards and MasterCards, but a single card is either one or the other. A VISA card provides no access to the MasterCard network, or vice versa: a MasterCard cannot access the VISA network.
Single Payment Networkdoes not state what Mykonos employees or custo- mers should do. Instead it states something that is always true; it states a general truth rather than a responsibility. No actions of a Mykonos employee or customer will violate Single Payment Network. In fact, only a major industry change—
e.g., an inter-access agreement between payment networks—will affect Single Payment Network, and that major industry change will not violate the rule so much as render it entirely invalid.
Single Payment Networkis anecessity statement. Each necessity statement is a statement of something that remains true. Some necessity statements express truths about the world, like Single Payment Network. Others express truths not about the world but about the way the organization defines the world.Large Partyis an example of this latter situation.
Large Party: It is necessary that a party is large if the size of the party is at least 8.
A party of 8 or 9 people is considered by Mykonos restaurants to be large. A party of 6 or 7 is not considered to be large, at least not byLarge Party. (Another rule may of course apply.) This division between 7 and 8 is how Mykonos chooses to structure its work. Other restaurants will divide party size differently, and some will not even have the concept of a large party.
The structure of a necessity statement is shown in Figure 6.7. A necessity statement starts with the phrase “It is necessary that.” A necessity statement includes an assured situation, the description of what is necessarily true. The assured situation ofLarge Party is “party is large” and the assured situation of Single Payment Network is “credit card is backed by exactly one payment
It is necessary that assured situation if condition
FIGURE 6.7 The structure of a necessity statement
152 CHAPTER 6 Business Rule Models
network.” The necessity statement also includes the word “if” and a condition. The condition ofLarge Partyis “the size of the party is at least 8.” As with obli- gation statements, the “if” and the condition are optional. For example,Single Payment Networkhas no condition.
A necessity statement is structurally a bit like an obligation statement. Both are about something positive. Just as an obligation statement states something that must be, a necessity statement states something that is always true. But the two forms of business rules are quite different in intent. An obligation statement expresses something that the organization mandates. A necessity statement is simply a statement of what is always true, either in the world or in the way the organization structures its knowledge about the world.
Necessity statements express structural business rules. Structural business rules are statements about what is. They cannot be violated and need not be enforced. Structural business rules are fundamentally different from operative business rules,those rules that state what should be. Obligation statements, pro- hibitive statements, and restricted permissive statements are all operative busi- ness rules. Operative business rules can be violated and must be enforced.
When do you write your business rule as a necessity statement? You use a necessity statement when some situation is always true by definition. You write the true-by-definition situation as the assured situation. If a condition applies, you add it.
Impossibility Statements
Necessity statements are not the only structural business rules. Impossibility statements are also structural business rules. Instead of stating what is always true, an impossibility statement states what is always false. For example,Single Payment Network Bis an impossibility statement.
Single Payment Network B:It is impossible that a credit card is backed by two payment networks.
A single credit card cannot be backed by two different payment networks. For example, the same credit card cannot be both a VISA and a Discover.
The structure ofSingle Payment Network B is shown in Figure 6.8. The impossibility business rule starts with “It is impossible that” and then continues with the incorrect situation, the situation that is always false. For Single
It is impossible that incorrect situation
FIGURE 6.8 The structure of a simple impossibility statement
Payment Network B, the incorrect situation is “a credit card is backed by two payment network.”
More complex impossibility business rules are also possible. ConsiderVege- tarian Menu Items.
Vegetarian Menu Items:It is impossible that a vegetarian menu item includes an ingredient if the ingredient is meat or the ingredient is fish.
Vegetarian Menu Itemsis true by definition. A vegetarian menu item contains no ingredient that is meat or fish.
The structure ofVegetarian Menu Itemsis shown inFigure 6.9. In addition to the incorrect situation, Figure 6.9 includes a condition, the scope of the impossibility. If the ingredient is meat or fish, then it is impossible that that the menu item is vegetarian. But if the ingredient is neither meat nor fish, the rule does not apply.
You might have noticed the parallel between impossibility statements and pro- hibitive statements. Both say what cannot be. But impossibility statements are structural, explaining what cannot be by definition. Prohibitive statements are operative, explaining what should not be by policy.
When do you write your business rule as an impossibility statement? You use an impossibility statement when some situation is always false by definition. You write the false-by-definition situation as the incorrect situation. If a condition applies, you add it.
Restricted Possibility Statements
The last of the business rule forms is the restricted possibility statement. A restricted possibility statement is also a structural statement, describing something that is true by definition. Instead of describing what is always true (like a necessity statement) or what is always false (an impossibility statement), a restricted possibil- ity statement describes what can be true only under certain conditions.
Let’s look at an example. Vegetarian Menu Items described earlier is an impossibility statement about vegetarian menu items. The same rule can instead be expressed as a restricted possibility statement, asVegetarian Menu Items B.
Vegetarian Menu Items B: It is possible that a vegetarian menu item includes an ingredient only if the ingredient is not meat and the ingredient is not fish.
It is impossible that incorrect situation if condition
FIGURE 6.9 The structure of a more complex impossibility statement
154 CHAPTER 6 Business Rule Models